Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-05 21:09:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-05 21:09:06 +0300
commitb042382bbf5a4977c5b5c6b0a9a33f4e8ca8d16d (patch)
treede31671ab7c6ca8c2a3721cbabd1f2a42b3d0194 /app/controllers/application_controller.rb
parenteabf8fd774fef6a54903e5141138f47bdafeb331 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index fa88ca91170..7cb629dee21 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -37,6 +37,7 @@ class ApplicationController < ActionController::Base
around_action :set_current_context
around_action :set_locale
around_action :set_session_storage
+ around_action :set_current_admin
after_action :set_page_title_header, if: :json_request?
after_action :limit_session_time, if: -> { !current_user }
@@ -473,6 +474,13 @@ class ApplicationController < ActionController::Base
response.headers['Page-Title'] = URI.escape(page_title('GitLab'))
end
+ def set_current_admin(&block)
+ return yield unless Feature.enabled?(:user_mode_in_session)
+ return yield unless current_user
+
+ Gitlab::Auth::CurrentUserMode.with_current_admin(current_user, &block)
+ end
+
def html_request?
request.format.html?
end