[Zope] Adding users programmatically!

Ibrahim Mubarak ibmub80 at yahoo.com
Wed Nov 12 13:15:57 EST 2003


Hi,

I am trying to add users using a Script(Python) in Zope. The acl_users folder in question is
inside a Plone site. I have another acl_users folder in the Root directory containing only
managers. Here is the script I am using:

<CODE>
if user_pswd != user_conf:
    return 0
#Roles MUST be a sequence
strUserRole = str(user_role)
if user_role == strUserRole:
    user_role = [user_role]
context.acl_users.userFolderAddUser(user_name, user_pswd, user_role,[''])
return 1
</CODE>

user_name, user_pswd, user_conf, and user_role are all parameters passed in from a page template.
All bindings left at their default values.

After I run this script, the user shows up in the user folder with all the right info but the user
can't log in. I tried adding a user to the user folder at the Root (using this script), but the
same thing happens. The user can log in only if I go to the user folder manually and change the
passward. I also tried to use userFolderEditUser after the add, but it still did not work.
I made lib/python/AccessControl/User.py spit out the password upon the creation of the user, and
nothing seemed out of the ordinary.

I looked all day at the code and the only thing that I figured out is that isAnonymousUser() in
MembershipTool.py is always returning true when the new user is trying to log in!

Anyone experienced the same thing? Any suggestions?

Thanks in advance.

BTW: Here is my setup:
Zope 2.6.1 w/ python 2.1.3
CMFPlone 1.0.1

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree



More information about the Zope mailing list