Exception: ActionPolicy::Unauthorized
- Defined in:
- lib/action_policy/authorizer.rb
Overview
Raised when ‘authorize!` check fails
Instance Attribute Summary collapse
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
-
#initialize(policy, rule, result = policy.result) ⇒ Unauthorized
constructor
NEXT_RELEASE: remove result fallback.
Constructor Details
#initialize(policy, rule, result = policy.result) ⇒ Unauthorized
NEXT_RELEASE: remove result fallback
9 10 11 12 13 14 15 |
# File 'lib/action_policy/authorizer.rb', line 9 def initialize(policy, rule, result = policy.result) @policy = policy.class @rule = rule @result = result super("Not authorized: #{@policy}##{@rule} returns false") end |
Instance Attribute Details
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
6 7 8 |
# File 'lib/action_policy/authorizer.rb', line 6 def policy @policy end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/action_policy/authorizer.rb', line 6 def result @result end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
6 7 8 |
# File 'lib/action_policy/authorizer.rb', line 6 def rule @rule end |