Exception: Fosm::AccessDenied

Inherits:
Error
  • Object
show all
Defined in:
lib/fosm/errors.rb

Overview

Raised when an actor attempts an action they don’t have a role for. Applies to both lifecycle events (fire!) and CRUD operations (fosm_authorize!).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action, actor = nil) ⇒ AccessDenied

Returns a new instance of AccessDenied.



45
46
47
48
49
50
# File 'lib/fosm/errors.rb', line 45

def initialize(action, actor = nil)
  @action = action
  @actor  = actor
  label   = actor_label(actor)
  super("Access denied: '#{label}' does not have a role that permits '#{action}'")
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



43
44
45
# File 'lib/fosm/errors.rb', line 43

def action
  @action
end

#actorObject (readonly)

Returns the value of attribute actor.



43
44
45
# File 'lib/fosm/errors.rb', line 43

def actor
  @actor
end