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
3ddd9f75
Commit
3ddd9f75
authored
Jan 25, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mass-assignment. Dont allow users w/o access to create team
parent
70e05801
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+4
-0
app/controllers/teams_controller.rb
app/controllers/teams_controller.rb
+4
-7
app/models/user.rb
app/models/user.rb
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
3ddd9f75
...
...
@@ -94,6 +94,10 @@ class ApplicationController < ActionController::Base
return
access_denied!
unless
can?
(
current_user
,
:download_code
,
project
)
end
def
authorize_create_team!
return
access_denied!
unless
can?
(
current_user
,
:create_team
,
nil
)
end
def
authorize_manage_user_team!
return
access_denied!
unless
user_team
.
present?
&&
can?
(
current_user
,
:manage_user_team
,
user_team
)
end
...
...
app/controllers/teams_controller.rb
View file @
3ddd9f75
class
TeamsController
<
ApplicationController
# Authorize
before_filter
:authorize_manage_user_team!
before_filter
:authorize_admin_user_team!
before_filter
:authorize_create_team!
,
only:
[
:new
,
:create
]
before_filter
:authorize_manage_user_team!
,
only:
[
:edit
,
:update
]
before_filter
:authorize_admin_user_team!
,
only:
[
:destroy
]
# Skip access control on public section
skip_before_filter
:authorize_manage_user_team!
,
only:
[
:index
,
:show
,
:new
,
:destroy
,
:create
,
:search
,
:issues
,
:merge_requests
]
skip_before_filter
:authorize_admin_user_team!
,
only:
[
:index
,
:show
,
:new
,
:create
,
:search
,
:issues
,
:merge_requests
]
layout
'user_team'
,
only:
[
:show
,
:edit
,
:update
,
:destroy
,
:issues
,
:merge_requests
,
:search
]
layout
'user_team'
,
except:
[
:new
,
:create
]
def
index
@teams
=
current_user
.
user_teams
.
order
(
'name ASC'
)
...
...
app/models/user.rb
View file @
3ddd9f75
...
...
@@ -40,7 +40,7 @@ class User < ActiveRecord::Base
attr_accessible
:email
,
:password
,
:password_confirmation
,
:remember_me
,
:bio
,
:name
,
:username
,
:skype
,
:linkedin
,
:twitter
,
:dark_scheme
,
:theme_id
,
:force_random_password
,
:extern_uid
,
:provider
,
as:
[
:default
,
:admin
]
attr_accessible
:projects_limit
,
as: :admin
attr_accessible
:projects_limit
,
:can_create_team
,
:can_create_group
,
as: :admin
attr_accessor
:force_random_password
...
...
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