gitlab-org--gitlab-foss/app/controllers/admin/impersonations_controller.rb
Imre Farkas bd3a484032
Add config to disable impersonation
Adds gitlab.impersonation_enabled config option defaulting to true to
keep the current default behaviour.

Only the act of impersonation is modified, impersonation token
management is not affected.
2018-11-29 09:37:16 +01:00

17 lines
448 B
Ruby

# frozen_string_literal: true
class Admin::ImpersonationsController < Admin::ApplicationController
skip_before_action :authenticate_admin!
before_action :authenticate_impersonator!
def destroy
original_user = stop_impersonation
redirect_to admin_user_path(original_user), status: :found
end
private
def authenticate_impersonator!
render_404 unless impersonator && impersonator.admin? && !impersonator.blocked?
end
end