Commit abdaa914 authored by Julien Muchembled's avatar Julien Muchembled

Ignore Unauthorized exceptions when evaluating worklists as anonymous user.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24787 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6c254163
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# #
############################################################################## ##############################################################################
import sys
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
from types import StringTypes from types import StringTypes
...@@ -446,6 +447,7 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False): ...@@ -446,6 +447,7 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
worklist_dict[wf_id] = a worklist_dict[wf_id] = a
if len(worklist_dict): if len(worklist_dict):
is_anonymous = getToolByName(self, 'portal_membership').isAnonymousUser()
portal_url = getToolByName(self, 'portal_url')() portal_url = getToolByName(self, 'portal_url')()
portal_catalog = getToolByName(self, 'portal_catalog') portal_catalog = getToolByName(self, 'portal_catalog')
search_result = getattr(self, "Base_getCountFromWorklistTable", None) search_result = getattr(self, "Base_getCountFromWorklistTable", None)
...@@ -509,11 +511,20 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False): ...@@ -509,11 +511,20 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
group_by_expression = ', '.join(total_criterion_id_list) group_by_expression = ', '.join(total_criterion_id_list)
assert COUNT_COLUMN_TITLE not in total_criterion_id_list assert COUNT_COLUMN_TITLE not in total_criterion_id_list
select_expression = ', '.join(select_expression) select_expression = ', '.join(select_expression)
catalog_brain_result = search_result(select_expression=select_expression, try:
group_by_expression=group_by_expression, catalog_brain_result = search_result(
query=query, select_expression=select_expression,
limit=None, group_by_expression=group_by_expression,
src__=src__) query=query,
limit=None,
src__=src__)
except Unauthorized:
if not is_anonymous:
raise
LOG('WorkflowTool.listActions', WARNING,
'Exception while computing worklists: %s'
% grouped_worklist_dict,
error=sys.exc_info())
if src__: if src__:
action_list.append(catalog_brain_result) action_list.append(catalog_brain_result)
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment