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
4734c3a7
Commit
4734c3a7
authored
Nov 19, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create an audit events overview on the project settings page.
parent
bcaf86da
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
1 deletion
+66
-1
app/controllers/projects/team_members_controller.rb
app/controllers/projects/team_members_controller.rb
+18
-1
app/helpers/audit_events_helper.rb
app/helpers/audit_events_helper.rb
+14
-0
app/views/audit_events/project_log.html.haml
app/views/audit_events/project_log.html.haml
+30
-0
app/views/projects/_settings_nav.html.haml
app/views/projects/_settings_nav.html.haml
+4
-0
No files found.
app/controllers/projects/team_members_controller.rb
View file @
4734c3a7
...
...
@@ -28,7 +28,24 @@ class Projects::TeamMembersController < Projects::ApplicationController
def
update
@user_project_relation
=
@project
.
project_members
.
find_by
(
user_id:
member
)
@user_project_relation
.
update_attributes
(
member_params
)
old_access_level
=
@user_project_relation
.
human_access
if
@user_project_relation
.
update_attributes
(
member_params
)
details
=
{
change:
"access_level"
,
from:
old_access_level
,
to:
@user_project_relation
.
human_access
,
target_id:
@user_project_relation
.
user_id
,
target_type:
"User"
,
target_details:
@user_project_relation
.
user
.
name
,
}
SecurityEvent
.
create
(
author_id:
current_user
.
id
,
entity_id:
@project
.
id
,
entity_type:
"Project"
,
details:
details
)
end
unless
@user_project_relation
.
valid?
flash
[
:alert
]
=
"User should have at least one role"
...
...
app/helpers/audit_events_helper.rb
0 → 100644
View file @
4734c3a7
module
AuditEventsHelper
def
human_text
(
details
)
details
.
map
{
|
key
,
value
|
select_keys
(
key
,
value
)
}.
join
(
" "
).
humanize
end
def
select_keys
(
key
,
value
)
if
key
.
match
(
/^target_.*/
)
""
else
"
#{
key
.
to_s
}
<strong>
#{
value
}
</strong>"
end
end
end
app/views/audit_events/project_log.html.haml
0 → 100644
View file @
4734c3a7
%h3
.page-title
Project Audit Events
%p
.light
Events in
#{
@project
.
path_with_namespace
}
%table
.table
%thead
%tr
%th
%th
%th
Author
%th
%th
%th
Action
%th
%th
Target
%tbody
-
@events
.
each
do
|
event
|
%tr
%td
%td
%td
#{
event
.
author_name
}
%td
%td
%td
#{
raw
human_text
(
event
.
details
)
}
%td
%td
#{
event
.
details
[
'target_details'
]
}
app/views/projects/_settings_nav.html.haml
View file @
4734c3a7
...
...
@@ -31,3 +31,7 @@
=
link_to
project_protected_branches_path
(
@project
)
do
%i
.fa.fa-lock
Protected branches
=
nav_link
(
controller: :audit_events
)
do
=
link_to
project_audit_events_path
(
@project
)
do
%i
.fa.fa-file-text-o
Audit Events
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