Class: SwitchUser::Provider::Devise

Inherits:
Base
  • Object
show all
Defined in:
lib/switch_user/provider/devise.rb

Instance Method Summary collapse

Methods inherited from Base

#clear_original_user, #current_user?, #current_users_without_scope, #login_exclusive, #login_inclusive, #logout_all, #original_user, #original_user=, #remember_current_user

Constructor Details

#initialize(controller) ⇒ Devise

Returns a new instance of Devise.



4
5
6
7
# File 'lib/switch_user/provider/devise.rb', line 4

def initialize(controller)
  @controller = controller
  @warden = @controller.warden
end

Instance Method Details

#current_user(scope = :user) ⇒ Object



17
18
19
# File 'lib/switch_user/provider/devise.rb', line 17

def current_user(scope = :user)
  @warden.user(scope)
end

#login(user, scope = :user) ⇒ Object



9
10
11
# File 'lib/switch_user/provider/devise.rb', line 9

def (user, scope = :user)
  @warden.session_serializer.store(user, scope)
end

#logout(scope = :user) ⇒ Object



13
14
15
# File 'lib/switch_user/provider/devise.rb', line 13

def logout(scope = :user)
  @warden.logout(scope)
end