Class: NtqTools::ImpersonationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- NtqTools::ImpersonationController
- Defined in:
- app/controllers/ntq_tools/impersonation_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/ntq_tools/impersonation_controller.rb', line 10 def index data = {} NtqTools.impersonation_user_models.each do |model| data[model.underscore] = model.constantize.all.map{|user| { id: user.id, label: label_for_user(user), }} end render json: { data: data } end |
#signin ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/controllers/ntq_tools/impersonation_controller.rb', line 21 def signin @resource = params[:model_name].camelize.constantize.find params[:id] sign_in(@resource) return redirect_to @resource.after_impersonation_path if @resource.respond_to?(:after_impersonation_path) redirect_to after_sign_in_path_for(@resource) end |