Commit 34fd557055e027b6423241e73b7cf26c741c0b6b
1 parent
6d45909f
Exists in
spb-stable
and in
2 other branches
Move user access check to Gitlab::UserAccess
Showing
2 changed files
with
19 additions
and
12 deletions
Show diff stats
lib/gitlab/git_access.rb
| ... | ... | @@ -61,18 +61,7 @@ module Gitlab |
| 61 | 61 | private |
| 62 | 62 | |
| 63 | 63 | def user_allowed?(user) |
| 64 | - return false if user.blocked? | |
| 65 | - | |
| 66 | - if Gitlab.config.ldap.enabled | |
| 67 | - if user.ldap_user? | |
| 68 | - # Check if LDAP user exists and match LDAP user_filter | |
| 69 | - Gitlab::LDAP::Access.open do |adapter| | |
| 70 | - return false unless adapter.allowed?(user) | |
| 71 | - end | |
| 72 | - end | |
| 73 | - end | |
| 74 | - | |
| 75 | - true | |
| 64 | + Gitlab::UserAccess.allowed?(user) | |
| 76 | 65 | end |
| 77 | 66 | end |
| 78 | 67 | end | ... | ... |
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +module Gitlab | |
| 2 | + module UserAccess | |
| 3 | + def self.allowed?(user) | |
| 4 | + return false if user.blocked? | |
| 5 | + | |
| 6 | + if Gitlab.config.ldap.enabled | |
| 7 | + if user.ldap_user? | |
| 8 | + # Check if LDAP user exists and match LDAP user_filter | |
| 9 | + Gitlab::LDAP::Access.open do |adapter| | |
| 10 | + return false unless adapter.allowed?(user) | |
| 11 | + end | |
| 12 | + end | |
| 13 | + end | |
| 14 | + | |
| 15 | + true | |
| 16 | + end | |
| 17 | + end | |
| 18 | +end | ... | ... |