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
Léo-Paul Géneau
gitlab-ce
Commits
09c8cf9d
Commit
09c8cf9d
authored
8 years ago
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove group members check
parent
ce96d482
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
24 deletions
+14
-24
app/controllers/groups/group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+0
-7
app/models/ability.rb
app/models/ability.rb
+3
-5
app/views/layouts/nav/_group.html.haml
app/views/layouts/nav/_group.html.haml
+5
-8
app/views/layouts/nav/_project.html.haml
app/views/layouts/nav/_project.html.haml
+1
-1
spec/controllers/groups/group_members_controller_spec.rb
spec/controllers/groups/group_members_controller_spec.rb
+5
-3
No files found.
app/controllers/groups/group_members_controller.rb
View file @
09c8cf9d
class
Groups::GroupMembersController
<
Groups
::
ApplicationController
# Authorize
before_action
:authorize_admin_group_member!
,
except:
[
:index
,
:leave
]
before_action
:authorize_read_group_members!
,
only:
[
:index
]
def
index
@project
=
@group
.
projects
.
find
(
params
[
:project_id
])
if
params
[
:project_id
]
...
...
@@ -80,10 +79,4 @@ class Groups::GroupMembersController < Groups::ApplicationController
def
member_params
params
.
require
(
:group_member
).
permit
(
:access_level
,
:user_id
)
end
private
def
authorize_read_group_members!
render_404
unless
can?
(
current_user
,
:read_group_members
,
@group
)
end
end
This diff is collapsed.
Click to expand it.
app/models/ability.rb
View file @
09c8cf9d
...
...
@@ -57,6 +57,7 @@ class Ability
:read_label
,
:read_milestone
,
:read_project_snippet
,
:read_project_member
,
:read_merge_request
,
:read_note
,
:read_commit_status
,
...
...
@@ -91,10 +92,7 @@ class Ability
subject
.
group
end
if
group
.
public?
rules
<<
:read_group
rules
<<
:read_group_members
unless
restricted_public_level?
end
rules
<<
:read_group
if
group
.
public?
rules
end
...
...
@@ -293,7 +291,7 @@ class Ability
def
group_abilities
(
user
,
group
)
rules
=
[]
rules
<<
[
:read_group
,
:read_group_members
]
if
can_read_group?
(
user
,
group
)
rules
<<
:read_group
if
can_read_group?
(
user
,
group
)
# Only group masters and group owners can create new projects
if
group
.
has_master?
(
user
)
||
group
.
has_owner?
(
user
)
||
user
.
admin?
...
...
This diff is collapsed.
Click to expand it.
app/views/layouts/nav/_group.html.haml
View file @
09c8cf9d
...
...
@@ -36,14 +36,11 @@
Merge Requests
-
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
,
group_id:
@group
.
id
,
state:
'opened'
).
execute
%span
.count
=
number_with_delimiter
(
merge_requests
.
count
)
-
if
can?
(
current_user
,
:read_group_members
,
@group
)
=
nav_link
(
controller:
[
:group_members
])
do
=
link_to
group_group_members_path
(
@group
),
title:
'Members'
do
=
icon
(
'users fw'
)
%span
Members
-
if
can?
(
current_user
,
:admin_group
,
@group
)
=
nav_link
(
html_options:
{
class:
"separate-item"
})
do
=
link_to
edit_group_path
(
@group
),
title:
'Settings'
do
...
...
This diff is collapsed.
Click to expand it.
app/views/layouts/nav/_project.html.haml
View file @
09c8cf9d
...
...
@@ -77,7 +77,7 @@
Merge Requests
%span
.count.merge_counter
=
number_with_delimiter
(
@project
.
merge_requests
.
opened
.
count
)
-
if
project_nav_tab?
(
:settings
)
-
if
project_nav_tab?
:settings
=
nav_link
(
controller:
[
:project_members
,
:teams
])
do
=
link_to
namespace_project_project_members_path
(
@project
.
namespace
,
@project
),
title:
'Members'
,
class:
'team-tab tab'
do
=
icon
(
'users fw'
)
...
...
This diff is collapsed.
Click to expand it.
spec/controllers/groups/group_members_controller_spec.rb
View file @
09c8cf9d
...
...
@@ -4,15 +4,17 @@ describe Groups::GroupMembersController do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
context
"
when public visibility level is restricted
"
do
context
"
index
"
do
before
do
group
.
add_owner
(
user
)
stub_application_setting
(
restricted_visibility_levels:
[
Gitlab
::
VisibilityLevel
::
PUBLIC
])
end
it
'
does not show
group members'
do
it
'
renders index with
group members'
do
get
:index
,
group_id:
group
.
path
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
render_template
(
:index
)
end
end
end
This diff is collapsed.
Click to expand it.
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