misc/migration/3.15.4_Any.py
author Dimitri Papadopoulos <dimitri.papadopoulos@cea.fr>
Thu, 13 Feb 2014 15:09:30 +0100
changeset 9515 b0dd5b57d2d8
parent 8522 85b1c4b36d1d
child 10589 7c23b7de2b8d
permissions -rw-r--r--
[dataimport, migration] more fixes in the spirit of a6c32edabc8d: [entity, metadata] huuum, use resolvable url as cwuri... And fix existing ones. Closes #3390388

from logilab.common.shellutils import generate_password
from cubicweb.server.utils import crypt_password

for user in rql('CWUser U WHERE U cw_source S, S name "system", U upassword P, U login L').entities():
    salt = user.upassword.getvalue()
    if crypt_password('', salt) == salt:
        passwd = generate_password()
        print 'setting random password for user %s' % user.login
        user.set_attributes(upassword=passwd)

commit()