[Zope-CMF] portal_catalog doesn't know about local roles ?
Tres Seaver
tseaver@zope.com
Mon, 11 Mar 2002 11:14:37 -0500 (EST)
On Mon, 11 Mar 2002, Jon Edwards wrote:
> >> Shouldn't you be able to query the catalog for items you are allowed to
> view
> >> by being granted local roles ?
> >
> > You *can* query the catalog for such objects, but only if you
> > had the local role *at the time the object was indexed*; the
> > 'allowedRolesAndUsers' index stores both role names and user
> > IDs of the users who had 'View' permission on the object when
> > it was indexed.
>
> So, would it be a good idea to add something to the folder_localrole_edit
> script that calls reindexObject on all the items in the folder (and
> sub-folders?) - or is there a better way to make sure that the info is
> updated when you add/delete local roles?
I would make it an option; if you are making multiple changes to
the local roles, for instance, it would make sense only to reindex
all the content one time.
A snippet which might help, to be added to the 'folder_localroles_edit'
script::
for brain in context.portal_catalog.searchResults(
path=context.getPhysicalPath() ):
brain.getObject().reindex_object()
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com