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
b68e1123
Commit
b68e1123
authored
Nov 21, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move event creation to service.
parent
e3d96fc2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
app/controllers/groups/group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+1
-6
app/controllers/projects/team_members_controller.rb
app/controllers/projects/team_members_controller.rb
+1
-6
app/services/audit_event_service.rb
app/services/audit_event_service.rb
+15
-0
No files found.
app/controllers/groups/group_members_controller.rb
View file @
b68e1123
...
@@ -25,12 +25,7 @@ class Groups::GroupMembersController < ApplicationController
...
@@ -25,12 +25,7 @@ class Groups::GroupMembersController < ApplicationController
target_type:
"User"
,
target_type:
"User"
,
target_details:
@member
.
user
.
name
,
target_details:
@member
.
user
.
name
,
}
}
SecurityEvent
.
create
(
AuditEventService
.
new
(
current_user
,
@group
,
details
).
security_event
author_id:
current_user
.
id
,
entity_id:
@group
.
id
,
entity_type:
"Group"
,
details:
details
)
end
end
end
end
...
...
app/controllers/projects/team_members_controller.rb
View file @
b68e1123
...
@@ -39,12 +39,7 @@ class Projects::TeamMembersController < Projects::ApplicationController
...
@@ -39,12 +39,7 @@ class Projects::TeamMembersController < Projects::ApplicationController
target_type:
"User"
,
target_type:
"User"
,
target_details:
@user_project_relation
.
user
.
name
,
target_details:
@user_project_relation
.
user
.
name
,
}
}
SecurityEvent
.
create
(
AuditEventService
.
new
(
current_user
,
@project
,
details
).
security_event
author_id:
current_user
.
id
,
entity_id:
@project
.
id
,
entity_type:
"Project"
,
details:
details
)
end
end
unless
@user_project_relation
.
valid?
unless
@user_project_relation
.
valid?
...
...
app/services/audit_event_service.rb
0 → 100644
View file @
b68e1123
class
AuditEventService
def
initialize
(
author
,
entity
,
details
=
{})
@author
,
@entity
,
@details
=
author
,
entity
,
details
end
def
security_event
SecurityEvent
.
create
(
author_id:
@author
.
id
,
entity_id:
@entity
.
id
,
entity_type:
@entity
.
class
.
name
,
details:
@details
)
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