Exception: Authz::Controllers::AuthorizationManager::NotAuthorized
- Inherits:
-
StandardError
- Object
- StandardError
- Authz::Controllers::AuthorizationManager::NotAuthorized
- Defined in:
- lib/authz/controllers/authorization_manager.rb
Overview
Error that will be raised if a user is not authorized
Instance Attribute Summary collapse
- #action ⇒ Object readonly
- #controller ⇒ Object readonly
- #instance ⇒ Object readonly
- #rolable ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ NotAuthorized
constructor
A new instance of NotAuthorized.
Constructor Details
#initialize(options = {}) ⇒ NotAuthorized
Returns a new instance of NotAuthorized.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/authz/controllers/authorization_manager.rb', line 42 def initialize( = {}) @rolable = .fetch :rolable @controller = .fetch :controller @action = .fetch :action @instance = .fetch(:instance, nil) msg = "#{rolable.class} #{rolable.id} " \ 'does not have a role that allows him to ' \ "#{controller}##{action}" if instance.present? msg += " on #{instance}." end super(msg) end |
Instance Attribute Details
#action ⇒ Object (readonly)
41 42 43 |
# File 'lib/authz/controllers/authorization_manager.rb', line 41 def action @action end |
#controller ⇒ Object (readonly)
41 42 43 |
# File 'lib/authz/controllers/authorization_manager.rb', line 41 def controller @controller end |
#instance ⇒ Object (readonly)
41 42 43 |
# File 'lib/authz/controllers/authorization_manager.rb', line 41 def instance @instance end |
#rolable ⇒ Object (readonly)
41 42 43 |
# File 'lib/authz/controllers/authorization_manager.rb', line 41 def rolable @rolable end |