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

Andrew Milton akm at theinternet.com.au
Thu Mar 5 03:29:24 EST 2009


+-------[ 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