[Zope-CMF] CMFCatalog question
Fabio Corneti
info at corneti.com
Thu Nov 23 14:25:00 EST 2006
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
integrated
into trunk):
http://www.zope.org/Collectors/CMF/380
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
info at corneti.com
More information about the Zope-CMF
mailing list