Exception: Garage::Unauthorized
- Defined in:
- lib/garage/exceptions.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#resource_class ⇒ Object
readonly
Returns the value of attribute resource_class.
-
#scopes ⇒ Object
readonly
Returns the value of attribute scopes.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from HTTPError
Instance Method Summary collapse
-
#initialize(user, action, resource_class, status = :forbidden, scopes = []) ⇒ Unauthorized
constructor
A new instance of Unauthorized.
Methods inherited from HTTPError
Constructor Details
#initialize(user, action, resource_class, status = :forbidden, scopes = []) ⇒ Unauthorized
Returns a new instance of Unauthorized.
19 20 21 22 23 24 25 26 27 |
# File 'lib/garage/exceptions.rb', line 19 def initialize(user, action, resource_class, status = :forbidden, scopes = []) @user, @action, @resource_class, @status, @scopes = user, action, resource_class, status, scopes if scopes.empty? super "Authorized user is not allowed to take the requested operation #{action} on #{resource_class}" else super "Insufficient scope to process the requested operation. Missing scope(s): #{scopes.join(", ")}" end end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
17 18 19 |
# File 'lib/garage/exceptions.rb', line 17 def action @action end |
#resource_class ⇒ Object (readonly)
Returns the value of attribute resource_class.
17 18 19 |
# File 'lib/garage/exceptions.rb', line 17 def resource_class @resource_class end |
#scopes ⇒ Object (readonly)
Returns the value of attribute scopes.
17 18 19 |
# File 'lib/garage/exceptions.rb', line 17 def scopes @scopes end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
17 18 19 |
# File 'lib/garage/exceptions.rb', line 17 def user @user end |