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
cfb10c10
Commit
cfb10c10
authored
Mar 17, 2016
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check push permissions only when pushing directly to target branch.
parent
f728e4b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
revert_service.rb
app/services/commits/revert_service.rb
+4
-3
No files found.
app/services/commits/revert_service.rb
View file @
cfb10c10
...
...
@@ -9,7 +9,8 @@ module Commits
@commit
=
params
[
:commit
]
@create_merge_request
=
params
[
:create_merge_request
].
present?
validate
and
commit
check_push_permissions
unless
@create_merge_request
commit
rescue
Repository
::
CommitError
,
Gitlab
::
Git
::
Repository
::
InvalidBlobName
,
GitHooksService
::
PreReceiveError
,
ValidationError
,
ReversionError
=>
ex
error
(
ex
.
message
)
...
...
@@ -45,11 +46,11 @@ module Commits
end
end
def
validate
def
check_push_permissions
allowed
=
::
Gitlab
::
GitAccess
.
new
(
current_user
,
project
).
can_push_to_branch?
(
@target_branch
)
unless
allowed
raise
_error
(
'You are not allowed to push into this branch'
)
raise
ValidationError
.
new
(
'You are not allowed to push into this branch'
)
end
true
...
...
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