The following script adds a new folder with a user folder inside it and then adds a user to the user folder. It works fine but the new user is unable to log in until I go to the ZMI and go to change the user password. I do not need to do anything more than press the change button on this page for the user to be then able to log in using the password specified in the script. Given that I will be adding up to 2000 users at a time with an ammended version of this script, this could become a little inconvenient. Am I doing something wrong? Zope Version (Zope 2.9.0, python 2.4.2, win32) Python Version 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] System Platform win32 roles='Manager' domains=[] password='go' confirm='go' name='BogeySmith' forms='7L' forms_obj = getattr(context, forms) forms_obj.manage_addFolder(name) path = str(forms+'/'+name) path_obj = context.restrictedTraverse(path) path_obj.manage_addUserFolder() path2 = str(forms+'/'+name) path_obj2 = context.restrictedTraverse(path2) userfolder = getattr(path_obj2, 'acl_users') userfolder.userFolderAddUser(name, password,roles,domains) regards garry
On Thu, 2007-02-15 at 18:58 +0100, Andreas Jung wrote:
--On 15. Februar 2007 17:34:10 +0000 garry saddington <garry@schoolteachers.co.uk> wrote:
roles='Manager'
As the name 'roles' indicates you have to specify a sequence of roles and not a *single* one.
-aj
Thanks this has fixed it but I still have questions: 1/Why can I specify only one when adding a user in the ZMI? 2/What if I only want one role for the user? 3/Why does it accept the one role from my script - it is highlighted when I go to the ZMI? Regards Garry
--On 15. Februar 2007 18:31:46 +0000 garry saddington <garry@schoolteachers.co.uk> wrote:
On Thu, 2007-02-15 at 18:58 +0100, Andreas Jung wrote:
--On 15. Februar 2007 17:34:10 +0000 garry saddington <garry@schoolteachers.co.uk> wrote:
roles='Manager'
As the name 'roles' indicates you have to specify a sequence of roles and not a *single* one.
-aj
Thanks this has fixed it but I still have questions:
1/Why can I specify only one when adding a user in the ZMI?
Isn't ['Manager'] a sequence of roles? A sequence of one role?
2/What if I only want one role for the user?
See above.
3/Why does it accept the one role from my script - it is highlighted when I go to the ZMI?
???? -aj
On Thu, 2007-02-15 at 19:35 +0100, Andreas Jung wrote:
--On 15. Februar 2007 18:31:46 +0000 garry saddington <garry@schoolteachers.co.uk> wrote:
On Thu, 2007-02-15 at 18:58 +0100, Andreas Jung wrote:
--On 15. Februar 2007 17:34:10 +0000 garry saddington <garry@schoolteachers.co.uk> wrote:
roles='Manager'
As the name 'roles' indicates you have to specify a sequence of roles and not a *single* one.
-aj
Thanks this has fixed it but I still have questions:
1/Why can I specify only one when adding a user in the ZMI?
Isn't ['Manager'] a sequence of roles? A sequence of one role?
Of course - sorry
2/What if I only want one role for the user?
See above.
3/Why does it accept the one role from my script - it is highlighted when I go to the ZMI?
What is confusing me is that with the problem script the user seems to be added with the correct role but only activated after the change user button is pressed. ie. The script does not report any errors and appears to complete. Anyway thanks for your help regards Garry
participants (2)
-
Andreas Jung -
garry saddington