BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
12e68d62
Commit
12e68d62
authored
Mar 08, 2018
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate `:push_code` before checking protected branches
parent
d11fbccc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
user_access.rb
lib/gitlab/user_access.rb
+3
-6
No files found.
lib/gitlab/user_access.rb
View file @
12e68d62
...
...
@@ -63,15 +63,12 @@ module Gitlab
request_cache
def
can_push_to_branch?
(
ref
)
return
false
unless
can_access_git?
return
false
unless
user
.
can?
(
:push_code
,
project
)
||
project
.
branch_allows_maintainer_push?
(
user
,
ref
)
if
protected
?(
ProtectedBranch
,
project
,
ref
)
return
true
if
project
.
user_can_push_to_empty_repo?
(
user
)
protected_branch_accessible_to?
(
ref
,
action:
:
push
)
elsif
user
.
can?
(
:push_code
,
project
)
true
project
.
user_can_push_to_empty_repo?
(
user
)
||
protected_branch_accessible_to?
(
ref
,
action:
:
push
)
else
project
.
branch_allows_maintainer_push?
(
user
,
ref
)
true
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