Exception: ActionPolicy::Unauthorized

Inherits:
Error
  • Object
show all
Defined in:
lib/action_policy/authorizer.rb

Overview

Raised when ‘authorize!` check fails

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(policy, rule) ⇒ Unauthorized

Returns a new instance of Unauthorized.



8
9
10
11
12
13
14
# File 'lib/action_policy/authorizer.rb', line 8

def initialize(policy, rule)
  @policy = policy.class
  @rule = rule
  @result = policy.result

  super("Not Authorized")
end

Instance Attribute Details

#policyObject (readonly)

Returns the value of attribute policy.



6
7
8
# File 'lib/action_policy/authorizer.rb', line 6

def policy
  @policy
end

#resultObject (readonly)

Returns the value of attribute result.



6
7
8
# File 'lib/action_policy/authorizer.rb', line 6

def result
  @result
end

#ruleObject (readonly)

Returns the value of attribute rule.



6
7
8
# File 'lib/action_policy/authorizer.rb', line 6

def rule
  @rule
end