server/sources/ldapuser.py
changeset 6931 0af44a38fe41
parent 6751 02091c91520f
parent 6887 72d7feeb071e
child 6943 406a41c25e13
--- a/server/sources/ldapuser.py	Mon Jan 24 19:09:42 2011 +0100
+++ b/server/sources/ldapuser.py	Tue Feb 01 11:52:10 2011 +0100
@@ -177,7 +177,7 @@
         self.cnx_dn = source_config.get('data-cnx-dn') or ''
         self.cnx_pwd = source_config.get('data-cnx-password') or ''
         self.user_base_scope = globals()[source_config['user-scope']]
-        self.user_base_dn = source_config['user-base-dn']
+        self.user_base_dn = str(source_config['user-base-dn'])
         self.user_base_scope = globals()[source_config['user-scope']]
         self.user_classes = splitstrip(source_config['user-classes'])
         self.user_login_attr = source_config['user-login-attr']
@@ -328,7 +328,7 @@
         return None
 
     def prepare_columns(self, mainvars, rqlst):
-        """return two list describin how to build the final results
+        """return two list describing how to build the final results
         from the result of an ldap search (ie a list of dictionnary)
         """
         columns = []
@@ -532,6 +532,8 @@
                 searchstr='(objectClass=*)', attrs=()):
         """make an ldap query"""
         self.debug('ldap search %s %s %s %s %s', self.uri, base, scope, searchstr, list(attrs))
+        # XXX for now, we do not have connection pool support for LDAP, so
+        # this is always self._conn
         cnx = session.pool.connection(self.uri).cnx
         try:
             res = cnx.search_s(base, scope, searchstr, attrs)
@@ -598,12 +600,13 @@
             entity.cw_edited[attr] = res[self.user_rev_attrs[attr]]
         return entity
 
-    def after_entity_insertion(self, session, dn, entity):
+    def after_entity_insertion(self, session, lid, entity):
         """called by the repository after an entity stored here has been
         inserted in the system table.
         """
         self.debug('ldap after entity insertion')
-        super(LDAPUserSource, self).after_entity_insertion(session, dn, entity)
+        super(LDAPUserSource, self).after_entity_insertion(session, lid, entity)
+        dn = lid
         for group in self.user_default_groups:
             session.execute('SET X in_group G WHERE X eid %(x)s, G name %(group)s',
                             {'x': entity.eid, 'group': group})