From 3d6b042e9e8613162b92b2f61342f2f0ee919924 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Wed, 18 Feb 2015 21:59:15 +0100 Subject: Fix push access check when not signed in. --- lib/gitlab/git_access.rb | 2 ++ 1 file changed, 2 insertions(+) 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) -- cgit v1.2.1