Exception: Shamu::Security::AccessDeniedError

Inherits:
Error
  • Object
show all
Defined in:
lib/shamu/security/error.rb

Overview

The requested action was not permitted on the resource.

Attributes collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = :access_denied, action: nil, resource: nil, principal: nil, additional_context: nil) ⇒ AccessDeniedError

Returns a new instance of AccessDeniedError.



40
41
42
43
44
45
46
47
# File 'lib/shamu/security/error.rb', line 40

def initialize( message = :access_denied, action: nil, resource: nil, principal: nil, additional_context: nil )
  @action             = action
  @resource           = resource
  @principal          = principal
  @additional_context = additional_context

  super translate( :access_denied, action: action, resource: resource )
end

Instance Attribute Details

#actionSymbol (readonly)

Returns the requested action that was denied.

Returns:

  • (Symbol)

    the requested action that was denied.



24
25
26
# File 'lib/shamu/security/error.rb', line 24

def action
  @action
end

#additional_contextObject (readonly)

Returns additional principal provided to the policy authorization method.

Returns:

  • (Object)

    additional principal provided to the policy authorization method.



35
36
37
# File 'lib/shamu/security/error.rb', line 35

def additional_context
  @additional_context
end

#principalPrincipal (readonly)

Returns the security Principal in use at the time of the policy violation.

Returns:



31
32
33
# File 'lib/shamu/security/error.rb', line 31

def principal
  @principal
end

#resourceObject (readonly)

Returns the resource the #action was to be performed on.

Returns:

  • (Object)

    the resource the #action was to be performed on.



27
28
29
# File 'lib/shamu/security/error.rb', line 27

def resource
  @resource
end