summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormanojmj <mmj@gitlab.com>2019-07-23 11:44:09 +0530
committermanojmj <mmj@gitlab.com>2019-07-23 11:44:09 +0530
commit3c9d75e045c94e25a53e78257b47c938f9c538a2 (patch)
tree614569ce55ff85add7227c73cc5393a313e38feb /spec
parent3a55ba7de49a1e3ce54bbf7b10640d66ed5af0bc (diff)
downloadgitlab-ce-3c9d75e045c94e25a53e78257b47c938f9c538a2.tar.gz
CE Port: Log impersonation actions in audit logce-port-315-log-impersonation-actions-in-audit-log
This change adds audit logs for user impersonation when an admin starts/stops impersonating another user.
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/admin/users_controller_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb
index 89a0eba66f7..d7428f8b52c 100644
--- a/spec/controllers/admin/users_controller_spec.rb
+++ b/spec/controllers/admin/users_controller_spec.rb
@@ -279,6 +279,12 @@ describe Admin::UsersController do
expect(warden.user).to eq(user)
end
+ it 'logs the beginning of the impersonation event' do
+ expect(Gitlab::AppLogger).to receive(:info).with("User #{admin.username} has started impersonating #{user.username}").and_call_original
+
+ post :impersonate, params: { id: user.username }
+ end
+
it "redirects to root" do
post :impersonate, params: { id: user.username }