On Thu, 8 Jun 2000, Mabe, Brad wrote:

> Forgive me if this has been covered before.
> 
> I am implementing a login/security scheme through the use of GUF and SQL
> methods.  My user and role information is kept in a SQL database and a user
> can have more than one role assigned to him/her.
> 
> What I would like to do is check if a specific role has been assigned to the
> current user, and then display some additional menu items if that role has
> been assigned.  I haven't been able to figure out how to get and check the
> roles that have been assigned to the current user.
> 
> As usual, any help will be greatly appreciated.

(untested)

<dtml-if "'myrole' in AUTHENTICATED_USER.getRolesInContext(this())">
    User has the myrole role
</dtml-if>

getRoles is also there if you don't want to check for local roles.

-- 
Stuart Bishop                          Work: [EMAIL PROTECTED]
Senior Systems Alchemist               Play: [EMAIL PROTECTED]
Computer Science, RMIT University


_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to