Hi all,
some days ago I needed a way to have portal_catalog.searchResults support
proxy roles;
after a bit of searching I found this patch for CMFCatalog (which has been
into trunk):


In this patch, the current user roles are replaced by the proxy roles (if
these are defined):

def _listAllowedRolesAndUsers(self, user):
    effective_roles = user.getRoles()
    sm = getSecurityManager()
    if sm.calledByExecutable():
        eo = sm._context.stack[-1]
        proxy_roles = getattr(eo, '_proxy_roles', None)
        if proxy_roles is not None:
>>>         effective_roles = proxy_roles
    result = list( effective_roles )
    result.append( 'Anonymous' )
    result.append( 'user:%s' % user.getId() )
    return result

Should proxy roles completely overwrite user roles or they should be added
like in the 
example below?

effective_roles = list(effective_roles) + list(proxy_roles)

I am asking this because the "replace" behavior broke some existing scripts
of mine if
I define Manager as a proxy role; if I add the proxy roles instead
everything works correctly
and I get the results granted by the Manager proxy role.

Thank you,
Fabio Corneti

Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to