--- a/sobjects/ldapparser.py Thu May 03 15:50:23 2012 +0200
+++ b/sobjects/ldapparser.py Thu May 03 15:52:01 2012 +0200
@@ -23,9 +23,13 @@
from base64 import b64decode
from logilab.common.decorators import cached
+from logilab.common.shellutils import generate_password
+from cubicweb import Binary
+from cubicweb.server.utils import crypt_password
from cubicweb.server.sources import datafeed
+
class DataFeedlDAPParser(datafeed.DataFeedParser):
__regid__ = 'ldapfeed'
# attributes that may appears in source user_attrs dict which are not
@@ -62,6 +66,12 @@
entity.cw_edited['address'] = sourceparams['address']
else:
self.ldap2cwattrs(sourceparams, entity.cw_edited)
+ pwd = entity.cw_edited.get('upassword')
+ if not pwd:
+ # generate a dumb password if not fetched from ldap (see
+ # userPassword)
+ pwd = crypt_password(generate_password())
+ entity.cw_edited = Binary(pwd)
return entity
def after_entity_copy(self, entity, sourceparams):