Class: Refinery::Authentication::Devise::AuthorisationManager
- Inherits:
-
Core::AuthorisationManager
- Object
- Core::AuthorisationManager
- Refinery::Authentication::Devise::AuthorisationManager
- Defined in:
- lib/refinery/authentication/devise/authorisation_manager.rb
Instance Method Summary collapse
-
#authenticate! ⇒ Object
The user needs the ‘refinery’ role to access the admin.
-
#default_adapter ⇒ Object
Override the default adapter specified in the superclass.
-
#set_user!(user) ⇒ Object
This allows a user to be supplied, bypassing the usual detection.
Instance Method Details
#authenticate! ⇒ Object
The user needs the ‘refinery’ role to access the admin.
10 11 12 13 14 15 16 |
# File 'lib/refinery/authentication/devise/authorisation_manager.rb', line 10 def authenticate! unless adapter.current_user.has_role?(:refinery) raise Zilch::Authorisation::NotAuthorisedException end adapter.current_user end |
#default_adapter ⇒ Object
Override the default adapter specified in the superclass.
19 20 21 |
# File 'lib/refinery/authentication/devise/authorisation_manager.rb', line 19 def default_adapter @default_adapter ||= Refinery::Authentication::Devise::AuthorisationAdapter.new end |
#set_user!(user) ⇒ Object
This allows a user to be supplied, bypassing the usual detection.
24 25 26 |
# File 'lib/refinery/authentication/devise/authorisation_manager.rb', line 24 def set_user!(user) adapter.current_user = user end |