Mercurial > moin > 1.9
changeset 2976:9314cf657f07
imported patch fix-ldap-patch (port from 1.6)
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sat, 05 Jan 2008 21:59:47 +0100 |
parents | ea78a739b5ad |
children | 6fdae05f0eeb |
files | MoinMoin/auth/ldap_login.py |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/auth/ldap_login.py Sat Jan 05 21:46:35 2008 +0100 +++ b/MoinMoin/auth/ldap_login.py Sat Jan 05 21:59:47 2008 +0100 @@ -74,12 +74,14 @@ # you can use %(username)s here to get the stuff entered in the form: filterstr = cfg.ldap_filter % locals() if verbose: request.log("LDAP: Searching %r" % filterstr) + attrs = [getattr(cfg, attr) for attr in [ + 'ldap_email_attribute', + 'ldap_aliasname_attribute', + 'ldap_surname_attribute', + 'ldap_givenname_attribute', + ] if (hasattr(cfg, attr) and getattr(cfg, attr) is not None)] lusers = l.search_st(cfg.ldap_base, cfg.ldap_scope, filterstr.encode(coding), - attrlist=[cfg.ldap_email_attribute, - cfg.ldap_aliasname_attribute, - cfg.ldap_surname_attribute, - cfg.ldap_givenname_attribute, - ], timeout=cfg.ldap_timeout) + attrlist=attrs, timeout=cfg.ldap_timeout) # we remove entries with dn == None to get the real result list: lusers = [(dn, ldap_dict) for dn, ldap_dict in lusers if dn is not None] if verbose: