[Zope-dev] Adding Users in Python

Andre Schubert andre.schubert@geyer.kabeljournal.de
Tue, 24 Oct 2000 14:36:22 +0200


Hi,

I'am using the following code in one of my Products.

obj =
Kunde.Kunde(id=row['name'],modem=row['modem'],db_id=row['id'],adress_id=row['adresse'])

                folder = AccessControl.User.UserFolder()
                obj._setObject('acl_users', folder)
                obj._addRole('Kunde')
                rechte = ['Access contents information','View']
                for recht in rechte:
                    p = AccessControl.Permission.Permission(recht, '',
obj)
                    p.setRole('Kunde', recht in rechte)
                obj.acl_users._addUser(name="test", password="passwort",
confirm="passwort", roles=['Kunde'], domains=[''])

I'am adding an obj of the Class Kunde in any Folder. The Class Kunde
should consist of an UserFolder, and has a Role named Kunde with the
Permissions Access contents information and View.
This all works fine, but inside the UserFolder a should should be added
with a name test and the password passwort.

Now the problem is, the user will be added, but the password does not
work. i have added a function test to User.py the returns the password
of the current user object.

    def test(self):
       """ doc string """
       return self.__

If i call the function test from a dtml document it returns "passwort"
as the password, but when the browser opens the authentication request
window and i write test as the username and passwort as the password i
get the message returned that the username or password is wrong. But
when i open the user-object in the acl_users and open the user test and
fill in in the password and confirm field the value of "passwort"
everything works fine.
No where is the problem. is it in my _addUser() function or somewhere
else?

Please Help.

as