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
Tatuya Kamada
gitlab-ce
Commits
8ad9a75f
Commit
8ad9a75f
authored
Oct 21, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8030 from cirosantilli/factor-authorize
Factor authorize_push! and authorize_code_access!
parents
85ddf1b9
4d0d5e79
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
18 additions
and
26 deletions
+18
-26
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+0
-8
app/controllers/projects/base_tree_controller.rb
app/controllers/projects/base_tree_controller.rb
+1
-1
app/controllers/projects/blame_controller.rb
app/controllers/projects/blame_controller.rb
+1
-1
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+2
-2
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+2
-2
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+1
-1
app/controllers/projects/commits_controller.rb
app/controllers/projects/commits_controller.rb
+1
-1
app/controllers/projects/compare_controller.rb
app/controllers/projects/compare_controller.rb
+1
-1
app/controllers/projects/edit_tree_controller.rb
app/controllers/projects/edit_tree_controller.rb
+1
-1
app/controllers/projects/graphs_controller.rb
app/controllers/projects/graphs_controller.rb
+1
-1
app/controllers/projects/network_controller.rb
app/controllers/projects/network_controller.rb
+1
-1
app/controllers/projects/new_tree_controller.rb
app/controllers/projects/new_tree_controller.rb
+1
-1
app/controllers/projects/raw_controller.rb
app/controllers/projects/raw_controller.rb
+1
-1
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+1
-1
app/controllers/projects/repositories_controller.rb
app/controllers/projects/repositories_controller.rb
+1
-1
app/controllers/projects/tags_controller.rb
app/controllers/projects/tags_controller.rb
+2
-2
No files found.
app/controllers/application_controller.rb
View file @
8ad9a75f
...
...
@@ -122,14 +122,6 @@ class ApplicationController < ActionController::Base
return
access_denied!
unless
can?
(
current_user
,
action
,
project
)
end
def
authorize_code_access!
return
access_denied!
unless
can?
(
current_user
,
:download_code
,
project
)
end
def
authorize_push!
return
access_denied!
unless
can?
(
current_user
,
:push_code
,
project
)
end
def
authorize_labels!
# Labels should be accessible for issues and/or merge requests
authorize_read_issue!
||
authorize_read_merge_request!
...
...
app/controllers/projects/base_tree_controller.rb
View file @
8ad9a75f
...
...
@@ -2,7 +2,7 @@ class Projects::BaseTreeController < Projects::ApplicationController
include
ExtractsPath
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
end
app/controllers/projects/blame_controller.rb
View file @
8ad9a75f
...
...
@@ -4,7 +4,7 @@ class Projects::BlameController < Projects::ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
def
show
...
...
app/controllers/projects/blob_controller.rb
View file @
8ad9a75f
...
...
@@ -4,9 +4,9 @@ class Projects::BlobController < Projects::ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
before_filter
:authorize_push!
,
only:
[
:destroy
]
before_filter
:authorize_push
_code
!
,
only:
[
:destroy
]
before_filter
:blob
...
...
app/controllers/projects/branches_controller.rb
View file @
8ad9a75f
...
...
@@ -3,8 +3,8 @@ class Projects::BranchesController < Projects::ApplicationController
before_filter
:authorize_read_project!
before_filter
:require_non_empty_project
before_filter
:authorize_
code_access
!
before_filter
:authorize_push!
,
only:
[
:create
,
:destroy
]
before_filter
:authorize_
download_code
!
before_filter
:authorize_push
_code
!
,
only:
[
:create
,
:destroy
]
def
index
@sort
=
params
[
:sort
]
||
'name'
...
...
app/controllers/projects/commit_controller.rb
View file @
8ad9a75f
...
...
@@ -4,7 +4,7 @@
class
Projects::CommitController
<
Projects
::
ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
before_filter
:commit
...
...
app/controllers/projects/commits_controller.rb
View file @
8ad9a75f
...
...
@@ -5,7 +5,7 @@ class Projects::CommitsController < Projects::ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
def
show
...
...
app/controllers/projects/compare_controller.rb
View file @
8ad9a75f
class
Projects::CompareController
<
Projects
::
ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
def
index
...
...
app/controllers/projects/edit_tree_controller.rb
View file @
8ad9a75f
class
Projects::EditTreeController
<
Projects
::
BaseTreeController
before_filter
:require_branch_head
before_filter
:blob
before_filter
:authorize_push!
before_filter
:authorize_push
_code
!
before_filter
:from_merge_request
before_filter
:after_edit_path
...
...
app/controllers/projects/graphs_controller.rb
View file @
8ad9a75f
class
Projects::GraphsController
<
Projects
::
ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
def
show
...
...
app/controllers/projects/network_controller.rb
View file @
8ad9a75f
...
...
@@ -4,7 +4,7 @@ class Projects::NetworkController < Projects::ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
def
show
...
...
app/controllers/projects/new_tree_controller.rb
View file @
8ad9a75f
class
Projects::NewTreeController
<
Projects
::
BaseTreeController
before_filter
:require_branch_head
before_filter
:authorize_push!
before_filter
:authorize_push
_code
!
def
show
end
...
...
app/controllers/projects/raw_controller.rb
View file @
8ad9a75f
...
...
@@ -4,7 +4,7 @@ class Projects::RawController < Projects::ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
def
show
...
...
app/controllers/projects/refs_controller.rb
View file @
8ad9a75f
...
...
@@ -3,7 +3,7 @@ class Projects::RefsController < Projects::ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
def
switch
...
...
app/controllers/projects/repositories_controller.rb
View file @
8ad9a75f
class
Projects::RepositoriesController
<
Projects
::
ApplicationController
# Authorize
before_filter
:authorize_read_project!
before_filter
:authorize_
code_access
!
before_filter
:authorize_
download_code
!
before_filter
:require_non_empty_project
def
archive
...
...
app/controllers/projects/tags_controller.rb
View file @
8ad9a75f
...
...
@@ -3,8 +3,8 @@ class Projects::TagsController < Projects::ApplicationController
before_filter
:authorize_read_project!
before_filter
:require_non_empty_project
before_filter
:authorize_
code_access
!
before_filter
:authorize_push!
,
only:
[
:create
]
before_filter
:authorize_
download_code
!
before_filter
:authorize_push
_code
!
,
only:
[
:create
]
before_filter
:authorize_admin_project!
,
only:
[
:destroy
]
def
index
...
...
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