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
1
Merge Requests
1
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
nexedi
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
app/services/commits/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