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
7534154b
Commit
7534154b
authored
Jan 23, 2013
by
Andrey Kumanyaev
Committed by
Dmitriy Zaporozhets
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add access control in public section to users teams
parent
dcea5220
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
app/controllers/teams/application_controller.rb
app/controllers/teams/application_controller.rb
+7
-0
app/controllers/teams/members_controller.rb
app/controllers/teams/members_controller.rb
+1
-1
app/controllers/teams/projects_controller.rb
app/controllers/teams/projects_controller.rb
+3
-0
No files found.
app/controllers/teams/application_controller.rb
View file @
7534154b
class
Teams::ApplicationController
<
ApplicationController
class
Teams::ApplicationController
<
ApplicationController
before_filter
:authorize_manage_user_team!
protected
protected
def
user_team
def
user_team
@user_team
||=
UserTeam
.
find_by_path
(
params
[
:team_id
])
@user_team
||=
UserTeam
.
find_by_path
(
params
[
:team_id
])
end
end
def
authorize_manage_user_team!
return
access_denied!
unless
can?
(
current_user
,
:manage_user_team
,
user_team
)
end
end
end
app/controllers/teams/members_controller.rb
View file @
7534154b
class
Teams::MembersController
<
Teams
::
ApplicationController
class
Teams::MembersController
<
Teams
::
ApplicationController
# Authorize
# Authorize
before_filter
:authorize_manage_user_team!
,
only:
[
:new
,
:edit
]
skip_before_filter
:authorize_manage_user_team!
,
only:
[
:index
]
def
index
def
index
@members
=
@user_team
.
members
@members
=
@user_team
.
members
...
...
app/controllers/teams/projects_controller.rb
View file @
7534154b
class
Teams::ProjectsController
<
Teams
::
ApplicationController
class
Teams::ProjectsController
<
Teams
::
ApplicationController
skip_before_filter
:authorize_manage_user_team!
,
only:
[
:index
]
def
index
def
index
@projects
=
user_team
.
projects
@projects
=
user_team
.
projects
@avaliable_projects
=
current_user
.
admin?
?
Project
.
without_team
(
user_team
)
:
(
Project
.
personal
(
current_user
)
+
current_user
.
projects
).
uniq
@avaliable_projects
=
current_user
.
admin?
?
Project
.
without_team
(
user_team
)
:
(
Project
.
personal
(
current_user
)
+
current_user
.
projects
).
uniq
...
...
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