diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-07-30 09:51:12 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-08-06 18:03:01 +0200 |
commit | 82dc40936a233edee59b4be45e0458883446ca9e (patch) | |
tree | 7cce7de47d00efe58d947edc31a908bf711e1574 /lib/gitlab/user_access.rb | |
parent | 669682686ea32a787aa9ef950388f780cfc00146 (diff) | |
download | gitlab-ce-82dc40936a233edee59b4be45e0458883446ca9e.tar.gz |
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.
Diffstat (limited to 'lib/gitlab/user_access.rb')
-rw-r--r-- | lib/gitlab/user_access.rb | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb index 16df21b49ba..4885baf9526 100644 --- a/lib/gitlab/user_access.rb +++ b/lib/gitlab/user_access.rb @@ -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 |