diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-02-18 23:24:06 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-02-18 23:24:06 +0000 |
commit | 7ad5fd6ce7d1180480e84f5596d1f80b0fe1091f (patch) | |
tree | 78defe90ca2bf92c4a4e8863b78ece64b89fbe33 /lib | |
parent | 716544085ce3d100f466103ba5d7c00a771ba6ca (diff) | |
parent | 3d6b042e9e8613162b92b2f61342f2f0ee919924 (diff) | |
download | gitlab-ce-7ad5fd6ce7d1180480e84f5596d1f80b0fe1091f.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git_access.rb | 2 |
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) |