Module: MnoEnterprise::ImpersonateHelper
- Defined in:
- app/helpers/mno_enterprise/impersonate_helper.rb
Instance Method Summary collapse
- #current_impersonator ⇒ Object
-
#impersonate(new_user) ⇒ Object
current_user changes from a staff user to
new_user
; current user stored insession[:impersonator_user_id]
. -
#revert_impersonate ⇒ Object
revert the
current_user
back to the staff user stored insession[:impersonator_user_id]
.
Instance Method Details
#current_impersonator ⇒ Object
21 22 23 24 |
# File 'app/helpers/mno_enterprise/impersonate_helper.rb', line 21 def current_impersonator return unless session[:impersonator_user_id] @admin_user ||= MnoEnterprise::User.find(session[:impersonator_user_id]) end |
#impersonate(new_user) ⇒ Object
current_user changes from a staff user to new_user
; current user stored in session[:impersonator_user_id]
6 7 8 9 10 |
# File 'app/helpers/mno_enterprise/impersonate_helper.rb', line 6 def impersonate(new_user) session[:impersonator_user_id] = current_user.id sign_out(current_user) sign_in new_user end |
#revert_impersonate ⇒ Object
revert the current_user
back to the staff user stored in session[:impersonator_user_id]
14 15 16 17 18 19 |
# File 'app/helpers/mno_enterprise/impersonate_helper.rb', line 14 def revert_impersonate return unless current_impersonator sign_out(current_user) sign_in(current_impersonator) session[:impersonator_user_id] = nil end |