Module: Trax::Controller::Authorize::ClassMethods

Defined in:
lib/trax/controller/authorize.rb

Instance Method Summary collapse

Instance Method Details

#actions_to_authorize(*_actions, all: false, except: false, only: false) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/trax/controller/authorize.rb', line 11

def actions_to_authorize(*_actions, all:false, except:false, only:false)
  _actions += (all || except) ? STANDARD_ACTIONS.dup : []
  _actions += only if only
  _actions.reject!{ |_action| except.include?(_action) } if except

  _actions.each do |action|
    action_module = ::Trax::Controller.config.authorization_adapter.authorization_action_for(action)
    include action_module if action_module
  end
end