summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-02-18 21:59:15 +0100
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-18 15:55:31 -0800
commite9d995ba679a226175869ea457871e6f0841585d (patch)
tree9e0c33b26200368113e4953064b935bf077e05ed
parente0bfa89c7cb2143f8633dfc78036bed39f0fca9c (diff)
downloadgitlab-ce-e9d995ba679a226175869ea457871e6f0841585d.tar.gz
Fix push access check when not signed in.
-rw-r--r--lib/gitlab/git_access.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index 6444cec7eb5..9b31190a882 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -6,6 +6,8 @@ module Gitlab
attr_reader :params, :project, :git_cmd, :user
def self.can_push_to_branch?(user, project, ref)
+ return false unless user
+
if project.protected_branch?(ref) &&
!(project.developers_can_push_to_protected_branch?(ref) && project.team.developer?(user))
user.can?(:push_code_to_protected_branches, project)