[Zope-CMF] Roles on Users, Roles in Portal

seb bacon seb@jamkit.com
Tue, 18 Sep 2001 10:19:42 +0100


* Chris Withers <chrisw@nipltd.com> [010917 23:47]:
> How should I find out what roles a user has in a skin method?

portal_membership.getAuthenticatedMember() is a 'normal' user wrapped
with CMF noodles, so you can use all your favourite AuthenticatedUser
methods, such as getRoles, hasRole and the like.

> How should I find out what roles are relevent in the current portal?

I think you're after this, from CMFCore.MembershipTool:

    def getPortalRoles(self):
        """
        Return all local roles defined by the portal itself,
        which means roles that are useful and understood 
        by the portal object
        """

seb