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
bbecfdfc
Commit
bbecfdfc
authored
Sep 12, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor audit event service
parent
42f7a58b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
27 deletions
+40
-27
ee/app/services/ee/audit_event_service.rb
ee/app/services/ee/audit_event_service.rb
+40
-27
No files found.
ee/app/services/ee/audit_event_service.rb
View file @
bbecfdfc
...
...
@@ -41,33 +41,6 @@ module EE
self
end
def
for_deploy_key
(
key_title
)
action
=
@details
[
:action
]
author_name
=
@author
.
name
@details
=
case
action
when
:destroy
{
remove:
"deploy_key"
,
author_name:
author_name
,
target_id:
key_title
,
target_type:
"DeployKey"
,
target_details:
key_title
}
when
:create
{
add:
"deploy_key"
,
author_name:
author_name
,
target_id:
key_title
,
target_type:
"DeployKey"
,
target_details:
key_title
}
end
self
end
def
for_failed_login
ip
=
@details
[
:ip_address
]
auth
=
@details
[
:with
]
||
'STANDARD'
...
...
@@ -133,5 +106,45 @@ module EE
details:
@details
)
end
def
method_missing
(
method_sym
,
*
arguments
,
&
block
)
super
(
method_sym
,
*
arguments
,
&
block
)
unless
respond_to?
(
method_sym
)
for_custom_model
(
method_sym
.
to_s
.
slice
(
'for_'
),
*
arguments
)
end
def
respond_to?
(
method
,
include_private
=
false
)
method
.
to_s
.
start_with?
(
'for_'
)
||
super
end
private
def
for_custom_model
(
model
,
key_title
)
action
=
@details
[
:action
]
author_name
=
@author
.
name
model_class
=
model
.
camelize
@details
=
case
action
when
:destroy
{
remove:
model
,
author_name:
author_name
,
target_id:
key_title
,
target_type:
model_class
,
target_details:
key_title
}
when
:create
{
add:
model
,
author_name:
author_name
,
target_id:
key_title
,
target_type:
model_class
,
target_details:
key_title
}
end
self
end
end
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