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
6bcb1a03
Commit
6bcb1a03
authored
Nov 21, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add removal and addition of the user to the group membership to audit events.
parent
4713fbd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
+31
-4
app/controllers/groups/group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+28
-2
app/controllers/projects/team_members_controller.rb
app/controllers/projects/team_members_controller.rb
+3
-2
No files found.
app/controllers/groups/group_members_controller.rb
View file @
6bcb1a03
...
...
@@ -7,7 +7,22 @@ class Groups::GroupMembersController < ApplicationController
layout
'group'
def
create
@group
.
add_users
(
params
[
:user_ids
].
split
(
','
),
params
[
:access_level
])
access_level
=
params
[
:access_level
]
user_ids
=
params
[
:user_ids
].
split
(
','
)
@group
.
add_users
(
user_ids
,
access_level
)
users
=
User
.
where
(
id:
user_ids
).
pluck
(
:id
,
:name
)
users
.
each
do
|
user
|
details
=
{
add:
"user_access"
,
as:
Gitlab
::
Access
.
options_with_owner
.
key
(
access_level
.
to_i
),
target_id:
user
[
0
],
target_type:
"User"
,
target_details:
user
[
1
],
}
AuditEventService
.
new
(
current_user
,
@group
,
details
).
security_event
end
redirect_to
members_group_path
(
@group
),
notice:
'Users were successfully added.'
end
...
...
@@ -33,7 +48,18 @@ class Groups::GroupMembersController < ApplicationController
@users_group
=
@group
.
group_members
.
find
(
params
[
:id
])
if
can?
(
current_user
,
:destroy
,
@users_group
)
# May fail if last owner.
@users_group
.
destroy
user_id
=
@users_group
.
id
user_name
=
@users_group
.
user
.
name
if
@users_group
.
destroy
details
=
{
remove:
"user_access"
,
target_id:
user_id
,
target_type:
"User"
,
target_details:
user_name
,
}
AuditEventService
.
new
(
current_user
,
@group
,
details
).
security_event
end
respond_to
do
|
format
|
format
.
html
{
redirect_to
members_group_path
(
@group
),
notice:
'User was successfully removed from group.'
}
format
.
js
{
render
nothing:
true
}
...
...
app/controllers/projects/team_members_controller.rb
View file @
6bcb1a03
...
...
@@ -16,12 +16,13 @@ class Projects::TeamMembersController < Projects::ApplicationController
def
create
users
=
User
.
where
(
id:
params
[
:user_ids
].
split
(
','
))
@project
.
team
<<
[
users
,
params
[
:access_level
]
]
access_level
=
params
[
:access_level
]
@project
.
team
<<
[
users
,
access_level
]
users
.
each
do
|
user
|
details
=
{
add:
"user_access"
,
as:
Gitlab
::
Access
.
options_with_owner
.
key
(
access_level
.
to_i
),
target_id:
user
.
id
,
target_type:
"User"
,
target_details:
user
.
name
,
...
...
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