[Zope] moving users

robert rottermann robert@redcor.ch
Tue, 7 Jan 2003 08:12:49 +0100


You can do it with an external script you name copyUser

def copyUser(oldfolder, newfolder):
    for u in oldfolder.getUsers():
        pw =3D u._getPassword()
        newfolder._doAddUser(u.getUserName(), pw, u.getRoles(),=20
u.getDomains())

this you call with from a python script as follows:

old_uf =3D context.tmp.acl_users
new_uf =3D context.acl_users
context.copyUser(old_uf, new_uf)

return "done"

hth
Robert

Am Montag, 6. Januar 2003 19.58 schrieb Ben Avery:
> I need to move all the users in an acl_users folder at a point in my
> folder structure into the acl_users folder further up, while still
> preserving the users there.
> How can I do this?
>
> There doesn't seem to be a way to cut and paste users between folders i=
n
> the ZMI, so I'll have to write a script to do this.
>
> Looking at the userFolder API, I would have to read all the users in th=
e
> source folder with getUsers(), then use userFolderAddUser with all the
> parameters to create the users in the destination folder.
> But I would need access to the password in order to create the users,
> which the user object doesn't give me.
>
> Can anyone think of a way to do this?
>
> TIA
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )