You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/07/09 14:29:41 UTC
[whimsy] branch master updated: WHIMSY-363 - allow override of
RW_HOSTS
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 767b324 WHIMSY-363 - allow override of RW_HOSTS
767b324 is described below
commit 767b324439602839d710f141fc6ef00f00cd34a6
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jul 9 15:29:31 2021 +0100
WHIMSY-363 - allow override of RW_HOSTS
Allow override of RW_HOSTS in Config.
Uses key:- :ldaprw, failing that :ldap
---
lib/whimsy/asf/ldap.rb | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 5e1bd21..abb5af7 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -130,7 +130,7 @@ module ASF
raise ::LDAP::ResultError.new('Unknown user') unless dn
ASF.ldap.unbind if ASF.ldap.bound? rescue nil
- ldap = ASF.init_ldap(true, RW_HOSTS)
+ ldap = ASF.init_ldap(true, self.rwhosts)
if block
ASF.flush_weakrefs
ldap.bind(dn, password, &block)
@@ -166,6 +166,15 @@ module ASF
@host
end
+ # allow override of RW_HOSTS by :ldaprw or :ldap config
+ def self.rwhosts
+ return @rwhosts if @rwhosts # cache the rwhosts list
+ rwhosts = Array(ASF::Config.get(:ldaprw))
+ rwhosts = Array(ASF::Config.get(:ldap)) if rwhosts.empty?
+ rwhosts = RW_HOSTS if rwhosts.empty?
+ @rwhosts = rwhosts
+ end
+
# determine what LDAP hosts are available
def self.hosts(use_config = true)
return @hosts if @hosts # cache the hosts list