Exception: Authority::SecurityViolation

Inherits:
StandardError
  • Object
show all
Defined in:
lib/authority.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, action, resource) ⇒ SecurityViolation

Returns a new instance of SecurityViolation.



62
63
64
65
66
# File 'lib/authority.rb', line 62

def initialize(user, action, resource)
  @user = user
  @action = action
  @resource = resource
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



60
61
62
# File 'lib/authority.rb', line 60

def action
  @action
end

#resourceObject (readonly)

Returns the value of attribute resource.



60
61
62
# File 'lib/authority.rb', line 60

def resource
  @resource
end

#userObject (readonly)

Returns the value of attribute user.



60
61
62
# File 'lib/authority.rb', line 60

def user
  @user
end

Instance Method Details

#messageObject



68
69
70
# File 'lib/authority.rb', line 68

def message
  "#{@user} is not authorized to #{@action} this resource: #{@resource}"
end