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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
4491a3d1
Commit
4491a3d1
authored
Dec 05, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decline push if repository does not exist
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
7cefd9c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+12
-3
No files found.
lib/gitlab/git_access.rb
View file @
4491a3d1
...
@@ -49,8 +49,17 @@ module Gitlab
...
@@ -49,8 +49,17 @@ module Gitlab
end
end
def
push_access_check
(
user
,
project
,
changes
)
def
push_access_check
(
user
,
project
,
changes
)
return
build_status_object
(
false
,
"You don't have access"
)
unless
user
&&
user_allowed?
(
user
)
unless
user
&&
user_allowed?
(
user
)
return
build_status_object
(
true
)
if
changes
.
blank?
return
build_status_object
(
false
,
"You don't have access"
)
end
if
changes
.
blank?
return
build_status_object
(
true
)
end
unless
project
.
repository
.
exists?
return
build_status_object
(
false
,
"Repository does not exist"
)
end
changes
=
changes
.
lines
if
changes
.
kind_of?
(
String
)
changes
=
changes
.
lines
if
changes
.
kind_of?
(
String
)
...
@@ -79,7 +88,7 @@ module Gitlab
...
@@ -79,7 +88,7 @@ module Gitlab
else
else
:push_code_to_protected_branches
:push_code_to_protected_branches
end
end
elsif
project
.
repository
&&
project
.
repository
.
tag_names
.
include?
(
tag_name
(
ref
))
elsif
project
.
repository
.
tag_names
.
include?
(
tag_name
(
ref
))
# Prevent any changes to existing git tag unless user has permissions
# Prevent any changes to existing git tag unless user has permissions
:admin_project
:admin_project
else
else
...
...
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