[Zope-PTK] CVS: ZopePTK - MembershipTool.py:1.9

Jens jens@zope.org
Wed, 31 Jan 2001 13:42:24 -0800


Update of /cvs-repository/ZopePTK/PTKBase
In directory zope.codeit.com:/tmp/cvs-serv25648

Modified Files:
	MembershipTool.py 
Log Message:
The membership tool will now allow roles to be mapped from an external user folder to roles that are understood by the CMF. To this end the MemberDataTool class has a few new methods:

- getPortalRoles
asks the portal for roles it defines itself, which by definition are understood by the portal itself. "Manager" is tacked on for good measure because even though the portal does not define it, it uses it.

- setRoleMapping
sets up a mapping from a portal-defined role to a role in the external user folder.

- getMappedRole
returns a role name if a portal-defined role is mapped to another role, otherwise returns an empty string.

In a nutshell, the membership tool carries a PersistentMapping which is checked each time a user object crosses through wrapUser and is not registered yet. all roles that the user has are checked to see if they are mapped to a portal-defined role, and if yes those portal-defined roles are tacked onto the list of roles carried by the user object.