From caa7b40a41ddf080a1a5b4f0a6170e3bffe1d498 Mon Sep 17 00:00:00 2001 From: Bhargava Kalathuru Date: Thu, 30 Oct 2014 10:17:36 -0700 Subject: [PATCH] [useradmin] Use the right 'search_bind_authentication' attribute used when using multidomain-style ldap config --- apps/useradmin/src/useradmin/ldap_access.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/useradmin/src/useradmin/ldap_access.py b/apps/useradmin/src/useradmin/ldap_access.py index f1a3ba7..b1b746a 100644 --- a/apps/useradmin/src/useradmin/ldap_access.py +++ b/apps/useradmin/src/useradmin/ldap_access.py @@ -35,12 +35,10 @@ CACHED_LDAP_CONN = None def get_connection_from_server(server=None): - if server: - return get_connection(desktop.conf.LDAP.LDAP_SERVERS.get()[server], search_bind_authentication=desktop.conf.LDAP.SEARCH_BIND_AUTHENTICATION.get()) - else: - return get_connection(desktop.conf.LDAP, search_bind_authentication=desktop.conf.LDAP.SEARCH_BIND_AUTHENTICATION.get()) + ldap_config = desktop.conf.LDAP.LDAP_SERVERS.get()[server] if server else desktop.conf.LDAP + return get_connection(ldap_config) -def get_connection(ldap_config, search_bind_authentication): +def get_connection(ldap_config): global CACHED_LDAP_CONN if CACHED_LDAP_CONN is not None: return CACHED_LDAP_CONN @@ -49,6 +47,7 @@ def get_connection(ldap_config, search_bind_authentication): username = ldap_config.BIND_DN.get() password = ldap_config.BIND_PASSWORD.get() ldap_cert = ldap_config.LDAP_CERT.get() + search_bind_authentication=ldap_config.SEARCH_BIND_AUTHENTICATION.get() if ldap_url is None: raise Exception('No LDAP URL was specified') @@ -358,4 +357,4 @@ class LdapConnection(object): return self._transform_find_group_results(result_data, name_attr, member_attr) def _get_root_dn(self): - return self.ldap_config.BASE_DN.get() \ No newline at end of file + return self.ldap_config.BASE_DN.get() -- 1.7.11.3.AMZN