5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/concerns/effective/impersonation_controller/impersonate.rb', line 5
def impersonate
@user = current_user.class.find(params[:id])
redirect_path = after_impersonate_path_for(@user)
authorize! :impersonate, @user
session[:impersonation_user_id] = current_user.id
session[:impersonation_original_path] = request.referer.presence || '/admin/users'
expire_data_after_sign_in!
warden.session_serializer.store(@user, Devise::Mapping.find_scope!(@user))
@user.touch
redirect_to(redirect_path)
end
|