[Zope-CMF] local roles

Florent Guillaume fg@nuxeo.com
Mon, 1 Jul 2002 15:20:07 +0000 (UTC)


> I wonder whether someone could point me in the right direction. I want to
> display action box only to users with an editorial role so I've put the
> following condition around the action box:
> 
> <dtml-if "AUTHENTICATED_USER.has_role('editor')or
> AUTHENTICATED_USER.has_role('Manager')">
> <dtml-var actions_box>
> </dtml-if> 
> 
> This works, but doesn't recognize users who have a local role 'editor' on a
> particular folder. How can I check whether they have a local role on a folder?
> getRoles() doesn't return local roles and get_local_roles()returns only the
> owner.

Yes, you have to use
portal_membership.getAuthenticatedMember().getRolesInContext(this())
which returns the list of roles in the current context.

Florent
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com