[Zope] Detecting Roles not working
Daniel Rusch
drusch@globalcrossing.com
Wed, 04 Oct 2000 11:23:20 -0500
<dtml-if "AUTHENTICATED_USER.has_role('Staff', this())">
This works for me, no pun intended :)
Dan
Kapil Thangavelu wrote:
>
> Jonathan Cheyne wrote:
> >
> > Hi all
> >
> > I have built the basis of a site with full, form-based webediting of
> > objects. Coming round to cleanup time and I wanted to remove certain
> > visible functions from the default object views unless you have already
> > logged in (with various possible roles)
> >
> > in the index_html of my zclass i have
> >
> > <dtml-if "AUTHENTICATED_USER.has_role('Staff')">
> > <a href="<dtml-var absolute_url>/<dtml-var type>edit">edit this</a><hr>
> > </dtml-if>
> > so if the user is anonymous or logged in without the Staff role assigne
> > they should not see the "edit this" link ...
> >
> > Doesn't work! It basically never returns a 'true' response thus never
> > displays the edit this link even when logged in.
>
> try (untested)
>
> <dtml-if "AUTHENTICATED_USER.has_role('Staff')==1"
>
> or (tested)
>
> <dtml-if "'Staff' in AUTHENTICATED_USER.getRoles()">
>
> Cheers
>
> Kapil
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> 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 )