[Zope-CMF] User roles

Shane Hathaway shane@digicool.com
Thu, 05 Apr 2001 09:54:44 -0400


Adrian Madrid wrote:
> 
> Sorry to be python illiterate but how do I get a list
> of those roles? I tried creating a python script like
> this one:
> 
> # Get all roles defined in user folder.
> if 'Translator' in
> SecurityManager().getUser().getRoles():
>     return 1
> else:
>     return 0
> 
> with _ as a parameter and then I called the script as:
> 
> <dtml-if "userRoles">x<dtml-else>y</dtml-if>
           ^^^^^^^^^^^
You need to remove the quotes or use "name=".  <dtml-if
name="userRoles"> is the same as <dtml-if userRoles>.  <dtml-if
"userRoles"> is the same as <dtml-if expr="userRoles">.

Shane