Commit 98f41a1a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

completely unrestrict ExplanationCache.getSimulationMovementValueList so that...

completely unrestrict ExplanationCache.getSimulationMovementValueList so that it returns the same value regardless of current user's permission.
parent 54ca377b
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
from zLOG import LOG from zLOG import LOG
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.Cache import transactional_cached from Products.ERP5Type.Cache import transactional_cached
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
class ExplanationCache: class ExplanationCache:
"""ExplanationCache provides a central access to """ExplanationCache provides a central access to
...@@ -162,6 +162,7 @@ class ExplanationCache: ...@@ -162,6 +162,7 @@ class ExplanationCache:
#XXXXXXXXXXX BAD #XXXXXXXXXXX BAD
return self.getSimulationMovementValueList(causality_uid=business_link.getUid()) return self.getSimulationMovementValueList(causality_uid=business_link.getUid())
@UnrestrictedMethod
def getSimulationMovementValueList(self, **kw): def getSimulationMovementValueList(self, **kw):
"""Search Simulation Movements related to our explanation. """Search Simulation Movements related to our explanation.
Cache result so that the second time we saarch for the same Cache result so that the second time we saarch for the same
...@@ -216,7 +217,7 @@ class ExplanationCache: ...@@ -216,7 +217,7 @@ class ExplanationCache:
catalog_kw['trade_phase_relative_url'] = catalog_kw['trade_phase'] catalog_kw['trade_phase_relative_url'] = catalog_kw['trade_phase']
del catalog_kw['trade_phase'] del catalog_kw['trade_phase']
self.simulation_movement_cache[kw_tuple] = \ self.simulation_movement_cache[kw_tuple] = \
self.portal_catalog.unrestrictedSearchResults(portal_type="Simulation Movement", self.portal_catalog(portal_type="Simulation Movement",
**catalog_kw) **catalog_kw)
return self.simulation_movement_cache[kw_tuple] return self.simulation_movement_cache[kw_tuple]
...@@ -229,7 +230,7 @@ class ExplanationCache: ...@@ -229,7 +230,7 @@ class ExplanationCache:
simulation_movement_list = self.getSimulationMovementValueList() simulation_movement_list = self.getSimulationMovementValueList()
simulation_movement_uid_list = map(lambda x:x.uid, simulation_movement_list) simulation_movement_uid_list = map(lambda x:x.uid, simulation_movement_list)
# We could use related keys instead of 2 queries # We could use related keys instead of 2 queries
business_link_list = self.portal_catalog.unrestrictedSearchResults( business_link_list = self.portal_catalog(
portal_type=business_type_list, portal_type=business_type_list,
causality_related_uid=simulation_movement_uid_list, causality_related_uid=simulation_movement_uid_list,
**kw) **kw)
......
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