Module: Authorization::Base::ControllerInstanceMethods
- Includes:
- EvalParser
- Defined in:
- lib/authorization.rb
Instance Method Summary collapse
-
#permit(authorization_expression, *args) ⇒ Object
Allow method-level authorization checks.
-
#permit?(authorization_expression, *args) ⇒ Boolean
Permit? turns off redirection by default and takes no blocks.
Methods included from EvalParser
#parse_authorization_expression, #process_role, #process_role_of_model, #replace_role, #replace_role_of_model, #replace_temporarily_role_of_model
Instance Method Details
#permit(authorization_expression, *args) ⇒ Object
Allow method-level authorization checks. permit (without a question mark ending) calls redirect on denial by default. Specify :redirect => false to turn off redirection.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/authorization.rb', line 56 def permit( , *args ) @options = { :allow_guests => false, :redirect => true } @options.merge!( args.last.is_a?( Hash ) ? args.last : {} ) if ( ) yield if block_given? elsif @options[:redirect] handle_redirection end end |
#permit?(authorization_expression, *args) ⇒ Boolean
Permit? turns off redirection by default and takes no blocks
46 47 48 49 50 51 |
# File 'lib/authorization.rb', line 46 def permit?( , *args ) @options = { :allow_guests => false, :redirect => false } @options.merge!( args.last.is_a?( Hash ) ? args.last : {} ) ( ) end |