There is an assertion in ZODBRoleManager, in the
listAssignedPrincipals method that makes it bomb when there's more
than one principal returned from searchPrincipals.

Now, while it doesn't make much sense to have principals with the same
id being returned by different plugins, that might be just the wrong
place to enforce this.

Is anyone against removing that assertion?

Reproducing the method below for the lazy:

    def listAssignedPrincipals( self, role_id ):

        """ Return a list of principal IDs to whom a role is assigned.
        """
        result = []

        for k, v in self._principal_roles.items():
            if role_id in v:
                # should be at most one and only one mapping to 'k'

                parent = aq_parent( self )
                info = parent.searchPrincipals( id=k, exact_match=True
                )
                assert( len( info ) in ( 0, 1 ) )
                if len( info ) == 0:
                    title = '<%s: not found>' % k
                else:
                    title = info[0].get( 'title', k )
                result.append( ( k, title ) )

        return result

-- 
Sidnei da Silva
Enfold Systems, LLC.
http://enfoldsystems.com
_______________________________________________
Zope-PAS mailing list
Zope-PAS@zope.org
http://mail.zope.org/mailman/listinfo/zope-pas

Reply via email to