[Zope] Detecting Roles not working
   
    Kapil Thangavelu
     
    kthangavelu@earthlink.net
       
    Wed, 04 Oct 2000 03:33:37 -0700
    
    
  
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