Small cleanup about LDAP

This commit is contained in:
Guillaume Ayoub 2012-03-13 10:47:01 +01:00
parent 3bfd6352b2
commit cc23d9dd8d
2 changed files with 5 additions and 4 deletions

View File

@ -61,12 +61,12 @@ def has_right(owner, user, password):
"LDAP bind for %s in base %s" % (distinguished_name, BASE)) "LDAP bind for %s in base %s" % (distinguished_name, BASE))
if FILTER: if FILTER:
filterStr = "(&(%s)%s)" % (distinguished_name,FILTER) filter_string = "(&(%s)%s)" % (distinguished_name, FILTER)
else: else:
filterStr = distinguished_name filter_string = distinguished_name
log.LOGGER.debug("Used LDAP filter: %s" % filterStr) log.LOGGER.debug("Used LDAP filter: %s" % filter_string)
users = CONNEXION.search_s(BASE, SCOPE, filterStr) users = CONNEXION.search_s(BASE, SCOPE, filter_string)
if users: if users:
log.LOGGER.debug("User %s found" % user) log.LOGGER.debug("User %s found" % user)
try: try:

View File

@ -58,6 +58,7 @@ INITIAL_CONFIG = {
"ldap_url": "ldap://localhost:389/", "ldap_url": "ldap://localhost:389/",
"ldap_base": "ou=users,dc=example,dc=com", "ldap_base": "ou=users,dc=example,dc=com",
"ldap_attribute": "uid", "ldap_attribute": "uid",
"ldap_filter": "",
"ldap_binddn": "", "ldap_binddn": "",
"ldap_password": "", "ldap_password": "",
"ldap_scope": "OneLevel", "ldap_scope": "OneLevel",