Class: Lesli::Role
- Inherits:
-
ApplicationLesliRecord
- Object
- ActiveRecord::Base
- ApplicationLesliRecord
- Lesli::Role
- Defined in:
- app/models/lesli/role.rb
Defined Under Namespace
Class Method Summary collapse
-
.list(current_user, query, params) ⇒ Object
Return a list of roles that the user is able to work with according to object level permission.
Instance Method Summary collapse
Class Method Details
.list(current_user, query, params) ⇒ Object
Return a list of roles that the user is able to work with according to object level permission
51 52 53 54 55 56 |
# File 'app/models/lesli/role.rb', line 51 def self.list(current_user, query, params) current_user.account.roles .where("object_level_permission <= ?", current_user.) .order(object_level_permission: :desc, name: :asc) .select(:id, :name, :object_level_permission) end |
Instance Method Details
#has_users? ⇒ Boolean
60 61 62 |
# File 'app/models/lesli/role.rb', line 60 def has_users? User::Role.where(role: self).count > 0 end |