Cache LDAP check in Gitlab::UserAccess
This changes the number of LDAP calls when users access GitLab via Git-over-SSH or the API. LDAP check results are cached for 1 hour.
This commit is contained in:
parent
669682686e
commit
82dc40936a
|
@ -3,13 +3,8 @@ module Gitlab
|
|||
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
|
||||
if user.requires_ldap_check?
|
||||
return false unless Gitlab::LDAP::Access.allowed?(user)
|
||||
end
|
||||
|
||||
true
|
||||
|
|
Loading…
Reference in New Issue