Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2a06b6a2
Commit
2a06b6a2
authored
Jan 23, 2020
by
manojmj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create audit log event for username changes
This change adds audit events when a user/admin changes username.
parent
189fe430
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
0 deletions
+29
-0
doc/administration/audit_events.md
doc/administration/audit_events.md
+1
-0
ee/app/services/ee/users/update_service.rb
ee/app/services/ee/users/update_service.rb
+1
-0
ee/changelogs/unreleased/7797-audit-log-include-username-changes.yml
...gs/unreleased/7797-audit-log-include-username-changes.yml
+5
-0
ee/spec/services/users/update_service_spec.rb
ee/spec/services/users/update_service_spec.rb
+22
-0
No files found.
doc/administration/audit_events.md
View file @
2a06b6a2
...
...
@@ -105,6 +105,7 @@ recorded:
-
Ask for password reset
-
Grant OAuth access
-
Started/stopped user impersonation
-
Changed username
It is possible to filter particular actions by choosing an audit data type from
the filter dropdown box. You can further filter by specific group, project or user
...
...
ee/app/services/ee/users/update_service.rb
View file @
2a06b6a2
...
...
@@ -23,6 +23,7 @@ module EE
audit_changes
(
:email
,
as:
'email address'
)
audit_changes
(
:encrypted_password
,
as:
'password'
,
skip_changes:
true
)
audit_changes
(
:username
,
as:
'username'
)
success
end
...
...
ee/changelogs/unreleased/7797-audit-log-include-username-changes.yml
0 → 100644
View file @
2a06b6a2
---
title
:
Create audit log when username changes
merge_request
:
23576
author
:
type
:
added
ee/spec/services/users/update_service_spec.rb
View file @
2a06b6a2
...
...
@@ -71,6 +71,28 @@ describe Users::UpdateService do
end
end
context
'audit events'
do
context
'licensed'
do
before
do
stub_licensed_features
(
admin_audit_log:
true
)
end
context
'updating username'
do
it
'logs audit event'
do
previous_username
=
user
.
username
new_username
=
'my_new_username'
expected_message
=
"Changed username from
#{
previous_username
}
to
#{
new_username
}
"
expect
do
update_user
(
user
,
username:
new_username
)
end
.
to
change
{
AuditEvent
.
count
}.
by
(
1
)
expect
(
AuditEvent
.
last
.
present
.
action
).
to
eq
(
expected_message
)
end
end
end
end
it
'does not update email if an user has group managed account'
do
allow
(
user
).
to
receive
(
:group_managed_account?
).
and_return
(
true
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment