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
0
Merge Requests
0
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
Tatuya Kamada
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
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
7 deletions
+16
-7
app/controllers/groups/group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+7
-0
app/models/ability.rb
app/models/ability.rb
+3
-2
app/views/dashboard/groups/index.html.haml
app/views/dashboard/groups/index.html.haml
+4
-3
app/views/groups/group_members/_group_member.html.haml
app/views/groups/group_members/_group_member.html.haml
+1
-1
app/views/groups/group_members/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
...
@@ -21,6 +21,8 @@ class Groups::GroupMembersController < Groups::ApplicationController
end
end
def
create
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
)
@group
.
add_users
(
params
[
:user_ids
].
split
(
','
),
params
[
:access_level
],
current_user
)
redirect_to
group_group_members_path
(
@group
),
notice:
'Users were successfully added.'
redirect_to
group_group_members_path
(
@group
),
notice:
'Users were successfully added.'
...
@@ -28,6 +30,9 @@ class Groups::GroupMembersController < Groups::ApplicationController
...
@@ -28,6 +30,9 @@ class Groups::GroupMembersController < Groups::ApplicationController
def
update
def
update
@member
=
@group
.
group_members
.
find
(
params
[
:id
])
@member
=
@group
.
group_members
.
find
(
params
[
:id
])
return
render_403
unless
can?
(
current_user
,
:update_group_member
,
@member
)
@member
.
update_attributes
(
member_params
)
@member
.
update_attributes
(
member_params
)
end
end
...
@@ -46,6 +51,8 @@ class Groups::GroupMembersController < Groups::ApplicationController
...
@@ -46,6 +51,8 @@ class Groups::GroupMembersController < Groups::ApplicationController
end
end
def
resend_invite
def
resend_invite
return
render_403
unless
can?
(
current_user
,
:admin_group_member
,
@group
)
redirect_path
=
group_group_members_path
(
@group
)
redirect_path
=
group_group_members_path
(
@group
)
@group_member
=
@group
.
group_members
.
find
(
params
[
:id
])
@group_member
=
@group
.
group_members
.
find
(
params
[
:id
])
...
...
app/models/ability.rb
View file @
f9bcb963
...
@@ -233,7 +233,8 @@ class Ability
...
@@ -233,7 +233,8 @@ class Ability
if
group
.
has_owner?
(
user
)
||
user
.
admin?
if
group
.
has_owner?
(
user
)
||
user
.
admin?
rules
.
push
(
*
[
rules
.
push
(
*
[
:admin_group
,
:admin_group
,
:admin_namespace
:admin_namespace
,
:admin_group_member
])
])
end
end
...
@@ -295,7 +296,7 @@ class Ability
...
@@ -295,7 +296,7 @@ class Ability
rules
=
[]
rules
=
[]
target_user
=
subject
.
user
target_user
=
subject
.
user
group
=
subject
.
group
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
)
if
can_manage
&&
(
user
!=
target_user
)
rules
<<
:update_group_member
rules
<<
:update_group_member
...
...
app/views/dashboard/groups/index.html.haml
View file @
f9bcb963
...
@@ -23,9 +23,10 @@
...
@@ -23,9 +23,10 @@
%i
.fa.fa-cogs
%i
.fa.fa-cogs
Settings
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
-
if
can?
(
current_user
,
:destroy_group_member
,
group_member
)
%i
.fa.fa-sign-out
=
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
Leave
%i
.fa.fa-sign-out
Leave
=
image_tag
group_icon
(
group
),
class:
"avatar s40 avatar-tile hidden-xs"
=
image_tag
group_icon
(
group
),
class:
"avatar s40 avatar-tile hidden-xs"
=
link_to
group
,
class:
'group-name'
do
=
link_to
group
,
class:
'group-name'
do
...
...
app/views/groups/group_members/_group_member.html.haml
View file @
f9bcb963
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
=
link_to
member
.
created_by
.
name
,
user_path
(
member
.
created_by
)
=
link_to
member
.
created_by
.
name
,
user_path
(
member
.
created_by
)
=
time_ago_with_tooltip
(
member
.
created_at
)
=
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
=
link_to
resend_invite_group_group_member_path
(
@group
,
member
),
method: :post
,
class:
"btn-xs btn"
,
title:
'Resend invite'
do
Resend invite
Resend invite
...
...
app/views/groups/group_members/index.html.haml
View file @
f9bcb963
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find existing member by name'
,
class:
'form-control search-text-input'
}
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find existing member by name'
,
class:
'form-control search-text-input'
}
=
button_tag
'Search'
,
class:
'btn'
=
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
.pull-right
=
button_tag
class:
'btn btn-new js-toggle-button'
,
type:
'button'
do
=
button_tag
class:
'btn btn-new js-toggle-button'
,
type:
'button'
do
Add members
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