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:
Jacob Vosmaer 2014-07-30 09:51:12 +02:00
parent 669682686e
commit 82dc40936a
1 changed files with 2 additions and 7 deletions

View File

@ -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