Commit 82dc4093 authored by Jacob Vosmaer's avatar Jacob Vosmaer

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.
parent 66968268
...@@ -3,13 +3,8 @@ module Gitlab ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment