Class: Lesli::Role::Power
- Inherits:
-
ApplicationLesliRecord
- Object
- ActiveRecord::Base
- ApplicationLesliRecord
- Lesli::Role::Power
- Defined in:
- app/models/lesli/role/power.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#synchronize_privileges ⇒ Object
after_destroy :synchronize_privileges.
Class Method Details
.index(current_user, query, role) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/models/lesli/role/power.rb', line 45 def self.index current_user, query, role #role.descriptors Descriptor .joins(:privileges) .left_joins(:role_descriptors) .joins(%( inner join system_controller_actions on system_controller_actions.id = descriptor_privileges.system_controller_action_id )).joins(%( inner join system_controllers on system_controllers.id = system_controller_actions.system_controller_id )) .select( "coalesce(role_descriptors.descriptor_id, descriptors.id) as id", "descriptors.name as name", "system_controllers.reference as reference", "system_controllers.route as controller", #"descriptors.category as action", "system_controller_actions.name as action", "system_controllers.engine as engine", "case when role_descriptors.descriptor_id is null then false else true end as active" ) end |
Instance Method Details
#synchronize_privileges ⇒ Object
after_destroy :synchronize_privileges
41 42 43 |
# File 'app/models/lesli/role/power.rb', line 41 def synchronize_privileges RoleDescriptorOperator.new(self.role.id).synchronize end |