BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
f9bcb963
Commit
f9bcb963
authored
Jul 28, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specific ability for managing group members
parent
43d11880
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
7 deletions
+16
-7
group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+7
-0
ability.rb
app/models/ability.rb
+3
-2
index.html.haml
app/views/dashboard/groups/index.html.haml
+4
-3
_group_member.html.haml
app/views/groups/group_members/_group_member.html.haml
+1
-1
index.html.haml
app/views/groups/group_members/index.html.haml
+1
-1
No files found.
app/controllers/groups/group_members_controller.rb
View file @
f9bcb963
...
...
@@ -21,6 +21,8 @@ class Groups::GroupMembersController < Groups::ApplicationController
end
def
create
return
render_403
unless
can?
(
current_user
,
:admin_group_member
,
@group
)
@group
.
add_users
(
params
[
:user_ids
].
split
(
','
),
params
[
:access_level
],
current_user
)
redirect_to
group_group_members_path
(
@group
),
notice:
'Users were successfully added.'
...
...
@@ -28,6 +30,9 @@ class Groups::GroupMembersController < Groups::ApplicationController
def
update
@member
=
@group
.
group_members
.
find
(
params
[
:id
])
return
render_403
unless
can?
(
current_user
,
:update_group_member
,
@member
)
@member
.
update_attributes
(
member_params
)
end
...
...
@@ -46,6 +51,8 @@ class Groups::GroupMembersController < Groups::ApplicationController
end
def
resend_invite
return
render_403
unless
can?
(
current_user
,
:admin_group_member
,
@group
)
redirect_path
=
group_group_members_path
(
@group
)
@group_member
=
@group
.
group_members
.
find
(
params
[
:id
])
...
...
app/models/ability.rb
View file @
f9bcb963
...
...
@@ -233,7 +233,8 @@ class Ability
if
group
.
has_owner?
(
user
)
||
user
.
admin?
rules
.
push
(
*
[
:admin_group
,
:admin_namespace
:admin_namespace
,
:admin_group_member
])
end
...
...
@@ -295,7 +296,7 @@ class Ability
rules
=
[]
target_user
=
subject
.
user
group
=
subject
.
group
can_manage
=
group_abilities
(
user
,
group
).
include?
(
:admin_group
)
can_manage
=
group_abilities
(
user
,
group
).
include?
(
:admin_group
_member
)
if
can_manage
&&
(
user
!=
target_user
)
rules
<<
:update_group_member
...
...
app/views/dashboard/groups/index.html.haml
View file @
f9bcb963
...
...
@@ -23,9 +23,10 @@
%i
.fa.fa-cogs
Settings
=
link_to
leave_group_group_members_path
(
group
),
data:
{
confirm:
leave_group_message
(
group
.
name
)
},
method: :delete
,
class:
"btn-sm btn btn-grouped"
,
title:
'Leave this group'
do
%i
.fa.fa-sign-out
Leave
-
if
can?
(
current_user
,
:destroy_group_member
,
group_member
)
=
link_to
leave_group_group_members_path
(
group
),
data:
{
confirm:
leave_group_message
(
group
.
name
)
},
method: :delete
,
class:
"btn-sm btn btn-grouped"
,
title:
'Leave this group'
do
%i
.fa.fa-sign-out
Leave
=
image_tag
group_icon
(
group
),
class:
"avatar s40 avatar-tile hidden-xs"
=
link_to
group
,
class:
'group-name'
do
...
...
app/views/groups/group_members/_group_member.html.haml
View file @
f9bcb963
...
...
@@ -24,7 +24,7 @@
=
link_to
member
.
created_by
.
name
,
user_path
(
member
.
created_by
)
=
time_ago_with_tooltip
(
member
.
created_at
)
-
if
show_controls
&&
can?
(
current_user
,
:admin_group
,
@group
)
-
if
show_controls
&&
can?
(
current_user
,
:admin_group
_member
,
member
)
=
link_to
resend_invite_group_group_member_path
(
@group
,
member
),
method: :post
,
class:
"btn-xs btn"
,
title:
'Resend invite'
do
Resend invite
...
...
app/views/groups/group_members/index.html.haml
View file @
f9bcb963
...
...
@@ -17,7 +17,7 @@
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find existing member by name'
,
class:
'form-control search-text-input'
}
=
button_tag
'Search'
,
class:
'btn'
-
if
current_user
&&
current_user
.
can?
(
:admin_group
,
@group
)
-
if
current_user
&&
current_user
.
can?
(
:admin_group
_member
,
@group
)
.pull-right
=
button_tag
class:
'btn btn-new js-toggle-button'
,
type:
'button'
do
Add members
...
...
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