From 3c3a933f85ad2e27d73d3b64782614bdaa5e7d8d Mon Sep 17 00:00:00 2001 From: holczer Date: Wed, 17 Jun 2020 14:08:19 +0200 Subject: [PATCH] simplified logging in multi server setups --- radicale_auth_ldap/__init__.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/radicale_auth_ldap/__init__.py b/radicale_auth_ldap/__init__.py index 2f6fb16..d5c79f0 100644 --- a/radicale_auth_ldap/__init__.py +++ b/radicale_auth_ldap/__init__.py @@ -37,19 +37,16 @@ import radicale_auth_ldap.ldap3imports class Auth(BaseAuth): def is_authenticated(self, user, password): """Check if ``user``/``password`` couple is valid.""" - server_list = self.configuration.get("auth", "ldap_url") - self.logger.warn("Server list type: %s" % type(server_list)) - self.logger.warn("Server list: %s" % server_list) - if ' ' in server_list: # Handle for multiple LDAP server defined in ldap_url with space separation - self.logger.warn("Server list contains multiple servers") - servers = server_list.split(' ') + servers = self.configuration.get("auth", "ldap_url") + if ' ' in servers: # Handle for multiple LDAP server defined in ldap_url with space separation + servers = servers.split(' ') + self.logger.debug("Multiple servers: %s" % servers) SERVER = ldap3.ServerPool(None) - self.logger.warn("Servers type: %s" % type(servers)) - self.logger.warn("Servers: %s" % servers) for s in servers: SERVER.add(ldap3.Server(s)) else: # only one server is defined - SERVER = ldap3.Server(server_list) + self.logger.debug("Single server: %s" % servers) + SERVER = ldap3.Server(servers) BASE = self.configuration.get("auth", "ldap_base") ATTRIBUTE = self.configuration.get("auth", "ldap_attribute") FILTER = self.configuration.get("auth", "ldap_filter")