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
Jérome Perrin
gitlab-ce
Commits
ff3caad4
Commit
ff3caad4
authored
Apr 10, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename manage_group ability to admin_group for consistency with project.
parent
ae6d0aaa
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
18 additions
and
18 deletions
+18
-18
app/controllers/groups/application_controller.rb
app/controllers/groups/application_controller.rb
+1
-1
app/controllers/groups/milestones_controller.rb
app/controllers/groups/milestones_controller.rb
+1
-1
app/models/ability.rb
app/models/ability.rb
+6
-6
app/views/dashboard/groups/index.html.haml
app/views/dashboard/groups/index.html.haml
+1
-1
app/views/groups/group_members/index.html.haml
app/views/groups/group_members/index.html.haml
+1
-1
app/views/groups/milestones/_milestone.html.haml
app/views/groups/milestones/_milestone.html.haml
+1
-1
app/views/groups/milestones/show.html.haml
app/views/groups/milestones/show.html.haml
+1
-1
app/views/groups/projects.html.haml
app/views/groups/projects.html.haml
+1
-1
app/views/layouts/nav/_group.html.haml
app/views/layouts/nav/_group.html.haml
+1
-1
lib/api/group_members.rb
lib/api/group_members.rb
+3
-3
lib/api/groups.rb
lib/api/groups.rb
+1
-1
No files found.
app/controllers/groups/application_controller.rb
View file @
ff3caad4
...
@@ -13,7 +13,7 @@ class Groups::ApplicationController < ApplicationController
...
@@ -13,7 +13,7 @@ class Groups::ApplicationController < ApplicationController
end
end
def
authorize_admin_group!
def
authorize_admin_group!
unless
can?
(
current_user
,
:
manage
_group
,
group
)
unless
can?
(
current_user
,
:
admin
_group
,
group
)
return
render_404
return
render_404
end
end
end
end
...
...
app/controllers/groups/milestones_controller.rb
View file @
ff3caad4
...
@@ -51,6 +51,6 @@ class Groups::MilestonesController < ApplicationController
...
@@ -51,6 +51,6 @@ class Groups::MilestonesController < ApplicationController
end
end
def
authorize_group_milestone!
def
authorize_group_milestone!
return
render_404
unless
can?
(
current_user
,
:
manage
_group
,
group
)
return
render_404
unless
can?
(
current_user
,
:
admin
_group
,
group
)
end
end
end
end
app/models/ability.rb
View file @
ff3caad4
...
@@ -198,11 +198,11 @@ class Ability
...
@@ -198,11 +198,11 @@ class Ability
])
])
end
end
# Only group owner and administrators can
manage
group
# Only group owner and administrators can
admin
group
if
group
.
has_owner?
(
user
)
||
user
.
admin?
if
group
.
has_owner?
(
user
)
||
user
.
admin?
rules
.
push
(
*
[
rules
.
push
(
*
[
:
manage
_group
,
:
admin
_group
,
:
manage
_namespace
:
admin
_namespace
])
])
end
end
...
@@ -212,11 +212,11 @@ class Ability
...
@@ -212,11 +212,11 @@ class Ability
def
namespace_abilities
(
user
,
namespace
)
def
namespace_abilities
(
user
,
namespace
)
rules
=
[]
rules
=
[]
# Only namespace owner and administrators can
manage
it
# Only namespace owner and administrators can
admin
it
if
namespace
.
owner
==
user
||
user
.
admin?
if
namespace
.
owner
==
user
||
user
.
admin?
rules
.
push
(
*
[
rules
.
push
(
*
[
:create_projects
,
:create_projects
,
:
manage
_namespace
:
admin
_namespace
])
])
end
end
...
@@ -254,7 +254,7 @@ class Ability
...
@@ -254,7 +254,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?
(
:
manage
_group
)
can_manage
=
group_abilities
(
user
,
group
).
include?
(
:
admin
_group
)
if
can_manage
&&
(
user
!=
target_user
)
if
can_manage
&&
(
user
!=
target_user
)
rules
<<
:modify_group_member
rules
<<
:modify_group_member
rules
<<
:destroy_group_member
rules
<<
:destroy_group_member
...
...
app/views/dashboard/groups/index.html.haml
View file @
ff3caad4
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
-
group
=
group_member
.
group
-
group
=
group_member
.
group
%li
%li
.pull-right
.pull-right
-
if
can?
(
current_user
,
:
manage
_group
,
group
)
-
if
can?
(
current_user
,
:
admin
_group
,
group
)
=
link_to
edit_group_path
(
group
),
class:
"btn-sm btn btn-grouped"
do
=
link_to
edit_group_path
(
group
),
class:
"btn-sm btn btn-grouped"
do
%i
.fa.fa-cogs
%i
.fa.fa-cogs
Settings
Settings
...
...
app/views/groups/group_members/index.html.haml
View file @
ff3caad4
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find existing member by name'
,
class:
'form-control search-text-input input-mn-300'
}
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find existing member by name'
,
class:
'form-control search-text-input input-mn-300'
}
=
button_tag
'Search'
,
class:
'btn'
=
button_tag
'Search'
,
class:
'btn'
-
if
current_user
&&
current_user
.
can?
(
:
manage
_group
,
@group
)
-
if
current_user
&&
current_user
.
can?
(
:
admin
_group
,
@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
...
...
app/views/groups/milestones/_milestone.html.haml
View file @
ff3caad4
%li
{
class:
"milestone milestone-#{milestone.closed? ? 'closed' : 'open'}"
,
id:
dom_id
(
milestone
.
milestones
.
first
)
}
%li
{
class:
"milestone milestone-#{milestone.closed? ? 'closed' : 'open'}"
,
id:
dom_id
(
milestone
.
milestones
.
first
)
}
.pull-right
.pull-right
-
if
can?
(
current_user
,
:
manage
_group
,
@group
)
-
if
can?
(
current_user
,
:
admin
_group
,
@group
)
-
if
milestone
.
closed?
-
if
milestone
.
closed?
=
link_to
'Reopen Milestone'
,
group_milestone_path
(
@group
,
milestone
.
safe_title
,
title:
milestone
.
title
,
milestone:
{
state_event: :activate
}),
method: :put
,
class:
"btn btn-sm btn-grouped btn-reopen"
=
link_to
'Reopen Milestone'
,
group_milestone_path
(
@group
,
milestone
.
safe_title
,
title:
milestone
.
title
,
milestone:
{
state_event: :activate
}),
method: :put
,
class:
"btn btn-sm btn-grouped btn-reopen"
-
else
-
else
...
...
app/views/groups/milestones/show.html.haml
View file @
ff3caad4
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
Open
Open
Milestone
#{
@group_milestone
.
title
}
Milestone
#{
@group_milestone
.
title
}
.pull-right
.pull-right
-
if
can?
(
current_user
,
:
manage
_group
,
@group
)
-
if
can?
(
current_user
,
:
admin
_group
,
@group
)
-
if
@group_milestone
.
active?
-
if
@group_milestone
.
active?
=
link_to
'Close Milestone'
,
group_milestone_path
(
@group
,
@group_milestone
.
safe_title
,
title:
@group_milestone
.
title
,
milestone:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-sm btn-close"
=
link_to
'Close Milestone'
,
group_milestone_path
(
@group
,
@group_milestone
.
safe_title
,
title:
@group_milestone
.
title
,
milestone:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-sm btn-close"
-
else
-
else
...
...
app/views/groups/projects.html.haml
View file @
ff3caad4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
.panel-heading
.panel-heading
%strong
=
@group
.
name
%strong
=
@group
.
name
projects:
projects:
-
if
can?
current_user
,
:
manage
_group
,
@group
-
if
can?
current_user
,
:
admin
_group
,
@group
.panel-head-actions
.panel-head-actions
=
link_to
new_project_path
(
namespace_id:
@group
.
id
),
class:
"btn btn-sm btn-success"
do
=
link_to
new_project_path
(
namespace_id:
@group
.
id
),
class:
"btn btn-sm btn-success"
do
%i
.fa.fa-plus
%i
.fa.fa-plus
...
...
app/views/layouts/nav/_group.html.haml
View file @
ff3caad4
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
%span
%span
Members
Members
-
if
can?
(
current_user
,
:
manage
_group
,
@group
)
-
if
can?
(
current_user
,
:
admin
_group
,
@group
)
=
nav_link
(
html_options:
{
class:
"
#{
"active"
if
group_settings_page?
}
separate-item"
})
do
=
nav_link
(
html_options:
{
class:
"
#{
"active"
if
group_settings_page?
}
separate-item"
})
do
=
link_to
edit_group_path
(
@group
),
title:
'Settings'
,
class:
"tab no-highlight"
do
=
link_to
edit_group_path
(
@group
),
title:
'Settings'
,
class:
"tab no-highlight"
do
%i
.fa.fa-cogs
%i
.fa.fa-cogs
...
...
lib/api/group_members.rb
View file @
ff3caad4
...
@@ -24,7 +24,7 @@ module API
...
@@ -24,7 +24,7 @@ module API
# POST /groups/:id/members
# POST /groups/:id/members
post
":id/members"
do
post
":id/members"
do
group
=
find_group
(
params
[
:id
])
group
=
find_group
(
params
[
:id
])
authorize!
:
manage
_group
,
group
authorize!
:
admin
_group
,
group
required_attributes!
[
:user_id
,
:access_level
]
required_attributes!
[
:user_id
,
:access_level
]
unless
validate_access_level?
(
params
[
:access_level
])
unless
validate_access_level?
(
params
[
:access_level
])
...
@@ -50,7 +50,7 @@ module API
...
@@ -50,7 +50,7 @@ module API
# PUT /groups/:id/members/:user_id
# PUT /groups/:id/members/:user_id
put
':id/members/:user_id'
do
put
':id/members/:user_id'
do
group
=
find_group
(
params
[
:id
])
group
=
find_group
(
params
[
:id
])
authorize!
:
manage
_group
,
group
authorize!
:
admin
_group
,
group
required_attributes!
[
:access_level
]
required_attributes!
[
:access_level
]
group_member
=
group
.
group_members
.
find_by
(
user_id:
params
[
:user_id
])
group_member
=
group
.
group_members
.
find_by
(
user_id:
params
[
:user_id
])
...
@@ -74,7 +74,7 @@ module API
...
@@ -74,7 +74,7 @@ module API
# DELETE /groups/:id/members/:user_id
# DELETE /groups/:id/members/:user_id
delete
":id/members/:user_id"
do
delete
":id/members/:user_id"
do
group
=
find_group
(
params
[
:id
])
group
=
find_group
(
params
[
:id
])
authorize!
:
manage
_group
,
group
authorize!
:
admin
_group
,
group
member
=
group
.
group_members
.
find_by
(
user_id:
params
[
:user_id
])
member
=
group
.
group_members
.
find_by
(
user_id:
params
[
:user_id
])
if
member
.
nil?
if
member
.
nil?
...
...
lib/api/groups.rb
View file @
ff3caad4
...
@@ -61,7 +61,7 @@ module API
...
@@ -61,7 +61,7 @@ module API
# DELETE /groups/:id
# DELETE /groups/:id
delete
":id"
do
delete
":id"
do
group
=
find_group
(
params
[
:id
])
group
=
find_group
(
params
[
:id
])
authorize!
:
manage
_group
,
group
authorize!
:
admin
_group
,
group
group
.
destroy
group
.
destroy
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