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
15df6af2
Commit
15df6af2
authored
Aug 01, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor audit changes after merge, fixed spec
parent
82f5cd46
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
19 deletions
+17
-19
app/services/audit_event_service.rb
app/services/audit_event_service.rb
+0
-15
app/services/users/update_service.rb
app/services/users/update_service.rb
+2
-2
ee/app/services/ee/audit_event_service.rb
ee/app/services/ee/audit_event_service.rb
+14
-0
lib/ee/audit/changes.rb
lib/ee/audit/changes.rb
+1
-1
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+0
-1
No files found.
app/services/audit_event_service.rb
View file @
15df6af2
...
...
@@ -16,21 +16,6 @@ class AuditEventService
self
end
def
for_changes
@details
=
{
change:
@details
[
:as
]
||
@details
[
:column
],
from:
@details
[
:from
],
to:
@details
[
:to
],
author_name:
@author
.
name
,
target_id:
@entity
.
id
,
target_type:
@entity
.
class
,
target_details:
@entity
.
name
}
self
end
def
security_event
SecurityEvent
.
create
(
author_id:
@author
.
id
,
...
...
app/services/users/update_service.rb
View file @
15df6af2
...
...
@@ -17,8 +17,8 @@ module Users
user_exists
=
@user
.
persisted?
if
@user
.
save
(
validate:
validate
)
audit_changes
:email
,
as:
'email address'
,
column: :notification_email
audit_changes
:encrypted_password
,
as:
'password'
,
skip_changes:
true
audit_changes
(
:email
,
as:
'email address'
,
column: :notification_email
)
audit_changes
(
:encrypted_password
,
as:
'password'
,
skip_changes:
true
)
notify_new_user
(
@user
,
nil
)
unless
user_exists
...
...
ee/app/services/ee/audit_event_service.rb
View file @
15df6af2
...
...
@@ -82,6 +82,20 @@ module EE
self
end
def
for_changes
@details
=
{
change:
@details
[
:as
]
||
@details
[
:column
],
from:
@details
[
:from
],
to:
@details
[
:to
],
author_name:
@author
.
name
,
target_id:
@entity
.
id
,
target_type:
@entity
.
class
,
target_details:
@entity
.
name
}
self
end
def
security_event
if
admin_audit_log_enabled?
add_security_event_admin_details!
...
...
lib/ee/audit/changes.rb
View file @
15df6af2
...
...
@@ -38,7 +38,7 @@ module EE
end
def
audit_event
(
options
)
AuditEventService
.
new
(
@current_user
,
model
,
options
).
::
AuditEventService
.
new
(
@current_user
,
model
,
options
).
for_changes
.
security_event
end
end
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
15df6af2
...
...
@@ -203,7 +203,6 @@ describe Gitlab::LDAP::Access do
it
'updates email address'
do
expect
(
access
).
to
receive
(
:update_email
).
once
expect
(
AuditEvents
.
count
).
to
eq
(
1
)
subject
end
...
...
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