Class: Lesli::Role::ActionService
- Inherits:
-
ApplicationLesliService
- Object
- ApplicationLesliService
- Lesli::Role::ActionService
- Defined in:
- app/services/lesli/role/action_service.rb
Instance Method Summary collapse
Methods inherited from ApplicationLesliService
#create, #delete, #error, #errors, #errors_as_sentence, #find, #found?, #initialize, #list, #result, #show, #successful?, #update
Constructor Details
This class inherits a constructor from Lesli::ApplicationLesliService
Instance Method Details
#index(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/services/lesli/role/action_service.rb', line 4 def index params role_actions = {} Lesli::Role::Action.joins(system_controller_action: :system_controller) .select( :id, :role_id, :action_id, :deleted_at, "lesli_system_controllers.id as controller_id", "lesli_system_controllers.name as controller_name", "lesli_system_controller_actions.name as controller_action_name", "case when lesli_role_actions.deleted_at is null then TRUE else FALSE end active" ).each do |action| unless role_actions.has_key?(action[:controller_name]) role_actions[action[:controller_name]] = { list:nil, index: nil, show:nil, create:nil, update:nil, destroy:nil } end if action[:controller_action_name] == "list" role_actions[action[:controller_name]][:list] = action end if action[:controller_action_name] == "index" role_actions[action[:controller_name]][:index] = action end if action[:controller_action_name] == "show" role_actions[action[:controller_name]][:show] = action end if action[:controller_action_name] == "create" role_actions[action[:controller_name]][:create] = action end if action[:controller_action_name] == "update" role_actions[action[:controller_name]][:update] = action end if action[:controller_action_name] == "destroy" role_actions[action[:controller_name]][:destroy] = action end end role_actions end |