diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-05-14 18:10:43 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2014-05-14 18:10:43 +0200 |
commit | f4bca105d16e3bc47c2cd2725c519d2dcd788e70 (patch) | |
tree | 39464dedc29c3c92799e59e55970a77978037974 | |
parent | f18f8e675594ba86a59176933f2521a9c6ec9f2f (diff) | |
download | gitlab-ce-f4bca105d16e3bc47c2cd2725c519d2dcd788e70.tar.gz |
Backport Adapter#ldap_search from EE
-rw-r--r-- | lib/gitlab/ldap/adapter.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/gitlab/ldap/adapter.rb b/lib/gitlab/ldap/adapter.rb index 0777558d643..7bdcb4b9743 100644 --- a/lib/gitlab/ldap/adapter.rb +++ b/lib/gitlab/ldap/adapter.rb @@ -64,7 +64,7 @@ module Gitlab end end - entries = ldap.search(options).select do |entry| + entries = ldap_search(options).select do |entry| entry.respond_to? config.uid end @@ -77,6 +77,22 @@ module Gitlab users(*args).first end + def ldap_search(*args) + results = ldap.search(*args) + + if results.nil? + response = ldap.get_operation_result + + unless response.code.zero? + Rails.logger.warn("LDAP search error: #{response.message}") + end + + [] + else + results + end + end + private def config |