Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-07-30 11:51:12 +0400
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-08-06 20:03:01 +0400
commit82dc40936a233edee59b4be45e0458883446ca9e (patch)
tree7cce7de47d00efe58d947edc31a908bf711e1574 /lib/gitlab/user_access.rb
parent669682686ea32a787aa9ef950388f780cfc00146 (diff)
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.rb9
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