[Zope-CMF] User roles

Adrian Madrid aem@byu.edu
Wed, 4 Apr 2001 20:36:49 -0700 (PDT)


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>

but I always get x even though the user is not a
Translator. How can I make it work

--- Tres Seaver <tseaver@novacoxmail.com> wrote:
> Adrian Madrid wrote:
> > 
> > How do I know which roles the current user has? I
> > tried with valid_roles but I get instead the whole
> > list.
> 
> In a PythonScript which binds '_' to the DTML
> namespace:
> 
>   # Get all roles defined in user folder.
>   _.SecurityManager().getUser().getRoles()
> 
>   # Get all roles pertaining to an object, 'foo'
>   _.SecurityGetUser().getRolesInContext( foo )
> 
> 
> Tres.

=====
---------------------------
Adrian Esteban Madrid
Benson Institute, Webmaster
Brigham Young University
---------------------------
adrian_esteban@madrid.com
===========================

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/