Sha256: 3f4aa452f6226827f5f9f5c684140e095aa60d565b1bea4f5d2ed22b0382edee

Contents?: true

Size: 1.86 KB

Versions: 5

Compression:

Stored size: 1.86 KB

Contents

=begin

Lesli

Copyright (c) 2023, Lesli Technologies, S. A.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.

Lesli · Ruby on Rails SaaS development platform.

Made with ♥ by https://www.lesli.tech
Building a better future, one line of code at a time.

@contact  hello@lesli.tech
@website  https://www.lesli.tech
@license  GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html

// · ~·~     ~·~     ~·~     ~·~     ~·~     ~·~     ~·~     ~·~     ~·~
// · 
=end

module CloudAudit
    class Users::RoleServices < ApplicationLesliServices

        # @overwrite
        # @return {Hash} Paginated list of the records
        # @param {query} Has of the formated queries/filters that will be applied to filter data
        # @description
        # @example
        def index 
            current_user.account.roles
            .joins("
                inner join (
                    select 
                        role_id, 
                        count(1) as users 
                    from user_roles ur 
                    group by role_id
                ) ur
                on ur.role_id = roles.id "
            ).select(
                "roles.id",
                "roles.name",
                "roles.active",
                "roles.object_level_permission",
                "ur.users"
            )
        end
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lesli_audit-0.5.0 app/services/lesli_audit/users/role_services.rb
lesli_audit-0.4.0 app/services/lesli_audit/users/role_services.rb
lesli_audit-0.3.0 app/services/lesli_audit/users/role_services.rb
lesli_audit-0.2.0 app/services/lesli_audit/users/role_services.rb
lesli_audit-0.1.0 app/services/lesli_audit/users/role_services.rb