Commit edc87797 authored by Julien Muchembled's avatar Julien Muchembled

Make domain tool do an unrestricted catalog search where getting applicable rules

parent 9e84b6ac
...@@ -57,11 +57,15 @@ class DomainTool(BaseTool): ...@@ -57,11 +57,15 @@ class DomainTool(BaseTool):
# XXX FIXME method should not be public # XXX FIXME method should not be public
# (some users are not able to see resource's price) # (some users are not able to see resource's price)
security.declarePublic('searchPredicateList') security.declarePublic('searchPredicateList')
def searchPredicateList(self, context, test=1, sort_method=None, def searchPredicateList(self, *args, **kw):
ignored_category_list=None, return self._searchPredicateList(restricted=True, *args, **kw)
tested_base_category_list=None,
filter_method=None, acquired=1, def _searchPredicateList(self, context, test=1, sort_method=None,
strict=True, sort_key_method=None, query=None, **kw): ignored_category_list=None,
tested_base_category_list=None,
filter_method=None, acquired=1,
strict=True, sort_key_method=None, query=None,
restricted=False, **kw):
# XXX: about "strict" parameter: This is a transition parameter, # XXX: about "strict" parameter: This is a transition parameter,
# allowing someone hitting a bug to revert to original behaviour easily. # allowing someone hitting a bug to revert to original behaviour easily.
# It is not a correct name, as pointed out by Jerome. But instead of # It is not a correct name, as pointed out by Jerome. But instead of
...@@ -231,7 +235,10 @@ class DomainTool(BaseTool): ...@@ -231,7 +235,10 @@ class DomainTool(BaseTool):
if query_list: if query_list:
kw['query'] = ComplexQuery(logical_operator='AND', *query_list) kw['query'] = ComplexQuery(logical_operator='AND', *query_list)
sql_result_list = portal_catalog.searchResults(**kw) if restricted:
sql_result_list = portal_catalog.searchResults(**kw)
else:
sql_result_list = portal_catalog.unrestrictedSearchResults(**kw)
if kw.get('src__'): if kw.get('src__'):
return sql_result_list return sql_result_list
result_list = [] result_list = []
......
...@@ -116,7 +116,7 @@ class RuleTool(BaseTool): ...@@ -116,7 +116,7 @@ class RuleTool(BaseTool):
# We don't know why it failed so let searchPredicateList do the work. # We don't know why it failed so let searchPredicateList do the work.
rule_uid_list.append(rule.getUid()) rule_uid_list.append(rule.getUid())
return rule_uid_list and portal.portal_domains.searchPredicateList( return rule_uid_list and portal.portal_domains._searchPredicateList(
context=movement, uid=rule_uid_list, context=movement, uid=rule_uid_list,
tested_base_category_list=tested_base_category_list) tested_base_category_list=tested_base_category_list)
......
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