Merge branch 'access-check-when-signed-out' into 'master'

Fix push access check when not signed in.

Was causing 500 on MR, Blob, Tree pages.

Fixes https://github.com/gitlabhq/gitlabhq/issues/8637 and https://github.com/gitlabhq/gitlabhq/issues/8813.

See merge request !1542
This commit is contained in:
Dmitriy Zaporozhets 2015-02-18 23:24:06 +00:00
commit 7ad5fd6ce7

View file

@ -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)