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