debian-mirror-gitlab/app/controllers/admin/impersonations_controller.rb

20 lines
485 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2016-06-02 11:05:42 +05:30
class Admin::ImpersonationsController < Admin::ApplicationController
skip_before_action :authenticate_admin!
before_action :authenticate_impersonator!
2023-05-27 22:25:52 +05:30
feature_category :user_management
2021-01-03 14:25:43 +05:30
2016-06-02 11:05:42 +05:30
def destroy
2019-02-15 15:39:39 +05:30
original_user = stop_impersonation
2018-11-18 11:00:15 +05:30
redirect_to admin_user_path(original_user), status: :found
2016-06-02 11:05:42 +05:30
end
private
def authenticate_impersonator!
2017-08-17 22:00:37 +05:30
render_404 unless impersonator && impersonator.admin? && !impersonator.blocked?
2016-06-02 11:05:42 +05:30
end
end