Exception: Uploader::AccessDenied

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

Overview

Exception class to raise when there is an authorized access exception thrown. The exception has a few goodies that may be useful for capturing / recognizing security issues.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, action, subject = nil) ⇒ AccessDenied

Returns a new instance of AccessDenied.



76
77
78
79
80
81
82
# File 'lib/uploader.rb', line 76

def initialize(user, action, subject = nil)
  @user = user
  @action = action
  @subject = subject

  super(message)
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



74
75
76
# File 'lib/uploader.rb', line 74

def action
  @action
end

#subjectObject (readonly)

Returns the value of attribute subject.



74
75
76
# File 'lib/uploader.rb', line 74

def subject
  @subject
end

#userObject (readonly)

Returns the value of attribute user.



74
75
76
# File 'lib/uploader.rb', line 74

def user
  @user
end

Instance Method Details

#messageObject



84
85
86
# File 'lib/uploader.rb', line 84

def message
  I18n.t('uploader.access_denied.message')
end