[Zope] how to check a user role with data entred by user?

Dvir Bar-lev dvir.b at puresight.com
Thu Mar 5 04:03:43 EST 2009


First tx for the reply Andrew.
How do I check that the password that was entered is the correct one for
that role than?
As it is presented in the reply the password of the role and the one
that the user entered aren't any consideration at all

-----Original Message-----
From: Andrew Milton [mailto:akm at theinternet.com.au] 
Sent: Thursday, March 05, 2009 10:29 AM
To: Dvir Bar-lev
Cc: zope at zope.org
Subject: Re: [Zope] how to check a user role with data entred by user?

+-------[ Dvir Bar-lev ]----------------------
| Hi all.
| 
|  
| 
| I have a question and I hope someone can help me out.
| 
| I?m new to zope and the all web thing, I?m using zope2.
| 
|  
| 
| What I did was this, I created a folder in the ZMI and there I created
a user
| folder(acl_users), in the user folder I defined  2 new roles.
| 
| Now, I have a log in form where the user fills out user name and
password, I
| want to check if the data he entered matches 1  of the roles I defined
in the
| ZMI . I can?t find any info or example how to do it, not on the web
nor in the
| documentation.
| 
|  
| 
| I would appreciate any help on the matter.

in a python script;

user = context.acl_users.getUser(theUserNameTheUserEnteredInTheForm)

if user.has_role(['Role1', 'Role2']):
  # User has role log them in I suppose
else:
  # Bad user! Bad!



-- 
Andrew Milton
akm at theinternet.com.au


More information about the Zope mailing list