[Zope] Re: Getting roles as a list

Stuart Woolford stuartw@newmail.net
Thu, 9 Sep 1999 15:00:26 +1200


On Thu, 09 Sep 1999, Jason Spisak wrote:
> Stuart,
> 
> I saw your posting on the list, and I was curious if you know how to get
> Zope to list the users for you.
> 
> I have been trying to get a select list of Users with no success.  I am
> unable to use the getUsers() method in a constructive way.
> 
> Any tips would be appreciated.
> 
> All my best,
> 
> Jason Spisak
> webmaster@mtear.com

I use the following:

<dtml-with acl_users>
<form action=<dtml-var URL0> METHOD="get">
<table cellspacing=0 border>
<dtml-in getUsers>
<tr><th>User Name</th><th>User Level</th><th>Password</th><th>Delete</th></tr>
<tr>
<td><dtml-var name></td>
<dtml-let theuser=sequence-item><td><select name="theroles:list">
<dtml-in "['none','restricted','readonly','update','system']">
<option value="<dtml-var sequence-item>" 
<dtml-if expr="_['sequence-item'] in
theuser.roles">SELECTED</dtml-if>>
<dtml-var sequence-item>
</dtml-in></select></td></dtml-let> <td><input type=password
name="thepass:list" value=<dtml-var "getPass(_['sequence-item'])">></td>
<td><input type="checkbox" name="delete:list" value=<dtml-var name>></td> </tr>
</dtml-in>
</table>
<input name=SUBMIT type="SUBMIT" value="Go">
</dtml-with>

This does a little moore than you are looking for, and there is more to this
form, but you get the idea? Only took me 3 days to guess it myself ;) Hope it
helps (and hope I've cut it out correctly, should work)
This trick is to acquire the acl_users from your parent folder, they you are
getting it's user list (NOT the base one, which you need to get
differently unless you are in the base directory)

--------------------------------------
Stuart Woolford, stuartw@newmail.net
Unix Consultant.
Software Developer.
Supra Club of New Zealand.
------------------------------------------------------------