Module: Arrthorizer::Rails::ControllerConcern::ClassMethods
- Defined in:
- lib/arrthorizer/rails/controller_concern.rb
Instance Method Summary collapse
-
#authorization_scope(scope) ⇒ Object
This method tells Arrthorizer the name of the method that it is supposed to use to find the user who is currently attempting to use a certain controller action.
-
#does_not_require_authorization(options = {}) ⇒ Object
This method sets up Arrthorizer to not verify requests to all (when no options are provided) or selected (when :only or :except are provided) actions in this controller and its subclasses.
-
#requires_authorization(options = {}) ⇒ Object
This method sets up Arrthorizer to verify that a user has the proper rights to access a # given controller action.
-
#to_prepare_context(&block) ⇒ Object
This is the configuration method for building Arrthorizer contexts from HTTP requests.
Instance Method Details
#authorization_scope(scope) ⇒ Object
This method tells Arrthorizer the name of the method that it is supposed to use to find the user who is currently attempting to use a certain controller action. This user is subsequently passed into all role verifications.
67 68 69 |
# File 'lib/arrthorizer/rails/controller_concern.rb', line 67 def (scope) self.arrthorizer_scope = scope end |
#does_not_require_authorization(options = {}) ⇒ Object
This method sets up Arrthorizer to not verify requests to all (when no options are provided) or selected (when :only or :except are provided) actions in this controller and its subclasses. Options can be provided and are passed to skip_filter.
84 85 86 |
# File 'lib/arrthorizer/rails/controller_concern.rb', line 84 def ( = {}) skip_filter :authorize, end |
#requires_authorization(options = {}) ⇒ Object
This method sets up Arrthorizer to verify that a user has the proper rights to access a # given controller action. Options can be provided and are passed to before_filter.
75 76 77 |
# File 'lib/arrthorizer/rails/controller_concern.rb', line 75 def ( = {}) before_filter :authorize, end |
#to_prepare_context(&block) ⇒ Object
This is the configuration method for building Arrthorizer contexts from HTTP requests. The developer specifies how contexts for authorization checks should be built by providing a block to this method. For more information, check the documentation on Arrthorizer::Rails::ControllerConfiguration
93 94 95 |
# File 'lib/arrthorizer/rails/controller_concern.rb', line 93 def to_prepare_context(&block) self.arrthorizer_configuration = Arrthorizer::Rails::ControllerConfiguration.new(&block) end |