Move user access check to Gitlab::UserAccess
This commit is contained in:
parent
6d45909f03
commit
34fd557055
2 changed files with 19 additions and 12 deletions
|
@ -61,18 +61,7 @@ module Gitlab
|
|||
private
|
||||
|
||||
def user_allowed?(user)
|
||||
return false if user.blocked?
|
||||
|
||||
if Gitlab.config.ldap.enabled
|
||||
if user.ldap_user?
|
||||
# Check if LDAP user exists and match LDAP user_filter
|
||||
Gitlab::LDAP::Access.open do |adapter|
|
||||
return false unless adapter.allowed?(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
true
|
||||
Gitlab::UserAccess.allowed?(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
18
lib/gitlab/user_access.rb
Normal file
18
lib/gitlab/user_access.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
module Gitlab
|
||||
module UserAccess
|
||||
def self.allowed?(user)
|
||||
return false if user.blocked?
|
||||
|
||||
if Gitlab.config.ldap.enabled
|
||||
if user.ldap_user?
|
||||
# Check if LDAP user exists and match LDAP user_filter
|
||||
Gitlab::LDAP::Access.open do |adapter|
|
||||
return false unless adapter.allowed?(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue