Exception: Authority::SecurityViolation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, action, resource) ⇒ SecurityViolation

Returns a new instance of SecurityViolation.



5
6
7
8
9
# File 'lib/authority/security_violation.rb', line 5

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

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/authority/security_violation.rb', line 3

def action
  @action
end

#resourceObject (readonly)

Returns the value of attribute resource.



3
4
5
# File 'lib/authority/security_violation.rb', line 3

def resource
  @resource
end

#userObject (readonly)

Returns the value of attribute user.



3
4
5
# File 'lib/authority/security_violation.rb', line 3

def user
  @user
end

Instance Method Details

#messageObject



11
12
13
# File 'lib/authority/security_violation.rb', line 11

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