diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-19 18:09:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-19 18:09:41 +0300 |
commit | 78d8830cec030ff12afed3c8ae1dddec454d0a24 (patch) | |
tree | b5494f60c7d28be787eee7872fd3d99dcbf9f8c8 /lib/gitlab/auth | |
parent | 652bd073731b0028641672a75355c7918b5ac116 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/auth')
-rw-r--r-- | lib/gitlab/auth/current_user_mode.rb | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/gitlab/auth/current_user_mode.rb b/lib/gitlab/auth/current_user_mode.rb index 06ae4d81870..0f327a39f61 100644 --- a/lib/gitlab/auth/current_user_mode.rb +++ b/lib/gitlab/auth/current_user_mode.rb @@ -77,7 +77,7 @@ module Gitlab return false unless user Gitlab::SafeRequestStore.fetch(admin_mode_rs_key) do - user.admin? && any_session_with_admin_mode? + user.admin? && session_with_admin_mode? end end @@ -136,19 +136,10 @@ module Gitlab @current_session ||= Gitlab::NamespacedSessionStore.new(SESSION_STORE_KEY) end - def any_session_with_admin_mode? + def session_with_admin_mode? return true if bypass_session? - return true if current_session_data.initiated? && current_session_data[ADMIN_MODE_START_TIME_KEY].to_i > MAX_ADMIN_MODE_TIME.ago.to_i - all_sessions.any? do |session| - session[ADMIN_MODE_START_TIME_KEY].to_i > MAX_ADMIN_MODE_TIME.ago.to_i - end - end - - def all_sessions - @all_sessions ||= ActiveSession.list_sessions(user).lazy.map do |session| - Gitlab::NamespacedSessionStore.new(SESSION_STORE_KEY, session.with_indifferent_access ) - end + current_session_data.initiated? && current_session_data[ADMIN_MODE_START_TIME_KEY].to_i > MAX_ADMIN_MODE_TIME.ago.to_i end def admin_mode_requested_in_grace_period? |