summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-05-05 04:08:45 +0000
committerStan Hu <stanhu@gmail.com>2016-05-05 04:08:45 +0000
commitf5ae92d81c022e94500eb9a6949b2322a943a5af (patch)
treed7bc12ef17a3d0d335b5d837d3eeb6764f2175c9
parent2cf8564cfe3f8e177258581553fce940fd5f6080 (diff)
parent731b231357f3b0b71f60a3bb1f81f8cd78f3e318 (diff)
downloadgitlab-ce-f5ae92d81c022e94500eb9a6949b2322a943a5af.tar.gz
Merge branch 'log-impersonation-events' into 'master'
Log to application.log when an admin starts and stops impersonating a user Closes gitlab-org/gitlab-ee#536 See merge request !4028
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/admin/impersonations_controller.rb2
-rw-r--r--app/controllers/admin/users_controller.rb2
3 files changed, 5 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index d2ff4c32f2d..ecd8b7c3474 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.8.0 (unreleased)
- Project#open_branches has been cleaned up and no longer loads entire records into memory.
+ - Log to application.log when an admin starts and stops impersonating a user
- Make build status canceled if any of the jobs was canceled and none failed
- Sanitize repo paths in new project error message
- Remove future dates from contribution calendar graph.
diff --git a/app/controllers/admin/impersonations_controller.rb b/app/controllers/admin/impersonations_controller.rb
index 2db824c87ef..8be35f00a77 100644
--- a/app/controllers/admin/impersonations_controller.rb
+++ b/app/controllers/admin/impersonations_controller.rb
@@ -7,6 +7,8 @@ class Admin::ImpersonationsController < Admin::ApplicationController
warden.set_user(impersonator, scope: :user)
+ Gitlab::AppLogger.info("User #{original_user.username} has stopped impersonating #{impersonator.username}")
+
session[:impersonator_id] = nil
redirect_to admin_user_path(original_user)
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index b8976fa09a9..f2f654c7bcd 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -41,6 +41,8 @@ class Admin::UsersController < Admin::ApplicationController
warden.set_user(user, scope: :user)
+ Gitlab::AppLogger.info("User #{current_user.username} has started impersonating #{user.username}")
+
flash[:alert] = "You are now impersonating #{user.username}"
redirect_to root_path