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)
|
def self.allowed?(user)
|
||||||
return false if user.blocked?
|
return false if user.blocked?
|
||||||
|
|
||||||
if Gitlab.config.ldap.enabled
|
if user.requires_ldap_check?
|
||||||
if user.ldap_user?
|
return false unless Gitlab::LDAP::Access.allowed?(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
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
Loading…
Reference in New Issue