diff options
author | Imre Farkas <ifarkas@gitlab.com> | 2019-02-23 21:18:44 +0300 |
---|---|---|
committer | Imre Farkas <ifarkas@gitlab.com> | 2019-02-27 13:44:58 +0300 |
commit | 44c4aad983570ea1832aa08c39f46dbc1b475fd3 (patch) | |
tree | 2c5445ccf54e3de7c8cc0a7c3efe39fcd423e867 /app | |
parent | 4bb06df7771999d13261d0cd05d678d89cba9aba (diff) |
Filter active sessions belonging to an admin impersonating the user
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/profiles/active_sessions_controller.rb | 2 | ||||
-rw-r--r-- | app/models/active_session.rb | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/profiles/active_sessions_controller.rb b/app/controllers/profiles/active_sessions_controller.rb index efe7ede5efa..6cf7a120449 100644 --- a/app/controllers/profiles/active_sessions_controller.rb +++ b/app/controllers/profiles/active_sessions_controller.rb @@ -2,7 +2,7 @@ class Profiles::ActiveSessionsController < Profiles::ApplicationController def index - @sessions = ActiveSession.list(current_user) + @sessions = ActiveSession.list(current_user).reject(&:is_impersonated) end def destroy diff --git a/app/models/active_session.rb b/app/models/active_session.rb index 0d9c6a4a1f0..1e01f1d17e6 100644 --- a/app/models/active_session.rb +++ b/app/models/active_session.rb @@ -5,7 +5,8 @@ class ActiveSession attr_accessor :created_at, :updated_at, :session_id, :ip_address, - :browser, :os, :device_name, :device_type + :browser, :os, :device_name, :device_type, + :is_impersonated def current?(session) return false if session_id.nil? || session.id.nil? @@ -31,7 +32,8 @@ class ActiveSession device_type: client.device_type, created_at: user.current_sign_in_at || timestamp, updated_at: timestamp, - session_id: session_id + session_id: session_id, + is_impersonated: request.session[:impersonator_id].present? ) redis.pipelined do |