[Zope] Q: filtering search results by checkPermission?

Noel Burton-Krahn noel@burton-krahn.com
Thu, 13 Jun 2002 09:15:16 -0700


I'm trying to filter a search results list to remove documents which the
current user doesn't have permission to view.  I wrote a python script which
tries to do just that.  I call

    checkPermission('View', x.absolute_url)

for every element in a doFormSearch result list, but it doesn't quite work.
What should I use instead of "x.absolute_url" to find the object of a search


# list_viewable = filterCheckPermissions(list_search_results)
# usage:
#    <dtml-let
from AccessControl import getSecurityManager
checkPermission = getSecurityManager().checkPermission;
return filter(lambda x: checkPermission('View', x.absolute_url), list)