Module: Authority::Controller::ClassMethods
- Defined in:
- lib/authority/controller.rb
Instance Method Summary (collapse)
-
- (Object) authority_action(action_map)
Allows defining and overriding a controller's map of its actions to the model's authorizer methods.
-
- (Hash) authority_action_map
The controller action to authority action map used for determining which Rails actions map to which authority actions (ex: index to read).
-
- (Object) authorize_actions_for(model_class, options = {})
Sets up before_filter to ensure user is allowed to perform a given controller action.
Instance Method Details
- (Object) authority_action(action_map)
Allows defining and overriding a controller's map of its actions to the model's authorizer methods
37 38 39 |
# File 'lib/authority/controller.rb', line 37 def (action_map) .merge!(action_map.symbolize_keys) end |
- (Hash) authority_action_map
The controller action to authority action map used for determining which Rails actions map to which authority actions (ex: index to read)
45 46 47 |
# File 'lib/authority/controller.rb', line 45 def @authority_action_map ||= Authority.configuration.controller_action_map.dup end |
- (Object) authorize_actions_for(model_class, options = {})
Sets up before_filter to ensure user is allowed to perform a given controller action
ones and any other options applicable to a before_filter
28 29 30 31 32 |
# File 'lib/authority/controller.rb', line 28 def (model_class, = {}) self. = model_class ([:actions] || {}) before_filter :run_authorization_check, end |