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
iv
gitlab-ce
Commits
f329d34f
Commit
f329d34f
authored
May 29, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix group projects fetch
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
8f259c5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+3
-3
spec/features/security/group/group_access_spec.rb
spec/features/security/group/group_access_spec.rb
+12
-0
No files found.
app/controllers/groups_controller.rb
View file @
f329d34f
...
...
@@ -5,7 +5,7 @@ class GroupsController < ApplicationController
# Authorize
before_filter
:authorize_read_group!
,
except:
[
:new
,
:create
]
before_filter
:authorize_admin_group!
,
only:
[
:edit
,
:update
,
:destroy
]
before_filter
:authorize_admin_group!
,
only:
[
:edit
,
:update
,
:destroy
,
:projects
]
before_filter
:authorize_create_group!
,
only:
[
:new
,
:create
]
# Load group projects
...
...
@@ -108,12 +108,12 @@ class GroupsController < ApplicationController
end
def
project_ids
projects
.
pluck
(
:id
)
@
projects
.
pluck
(
:id
)
end
# Dont allow unauthorized access to group
def
authorize_read_group!
unless
@group
and
(
projects
.
present?
or
can?
(
current_user
,
:read_group
,
@group
))
unless
@group
and
(
@
projects
.
present?
or
can?
(
current_user
,
:read_group
,
@group
))
if
current_user
.
nil?
return
authenticate_user!
else
...
...
spec/features/security/group/group_access_spec.rb
View file @
f329d34f
...
...
@@ -82,5 +82,17 @@ describe "Group access", feature: true do
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
end
describe
"GET /groups/:path/projects"
do
subject
{
projects_group_path
(
group
)
}
it
{
should
be_allowed_for
owner
}
it
{
should
be_denied_for
master
}
it
{
should
be_denied_for
reporter
}
it
{
should
be_allowed_for
:admin
}
it
{
should
be_denied_for
guest
}
it
{
should
be_denied_for
:user
}
it
{
should
be_denied_for
:visitor
}
end
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