Commit ae1c3380 authored by Nicolas Wavrant's avatar Nicolas Wavrant

make solve functions of solvers private and unrestricted

parent ba66c108
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
# #
############################################################################## ##############################################################################
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5.mixin.solver import ConfigurablePropertySolverMixin from Products.ERP5.mixin.solver import ConfigurablePropertySolverMixin
class AcceptSolver(ConfigurablePropertySolverMixin): class AcceptSolver(ConfigurablePropertySolverMixin):
...@@ -35,8 +38,13 @@ class AcceptSolver(ConfigurablePropertySolverMixin): ...@@ -35,8 +38,13 @@ class AcceptSolver(ConfigurablePropertySolverMixin):
meta_type = 'ERP5 Accept Solver' meta_type = 'ERP5 Accept Solver'
portal_type = 'Accept Solver' portal_type = 'Accept Solver'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# ISolver Implementation # ISolver Implementation
# XXX-Leo: Needs security declaration! It's currently public. security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, activate_kw=None): def solve(self, activate_kw=None):
""" """
Adopt new property to simulation movements, with keeping the Adopt new property to simulation movements, with keeping the
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
# #
############################################################################## ##############################################################################
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5.mixin.solver import ConfigurablePropertySolverMixin from Products.ERP5.mixin.solver import ConfigurablePropertySolverMixin
class AdoptSolver(ConfigurablePropertySolverMixin): class AdoptSolver(ConfigurablePropertySolverMixin):
...@@ -35,8 +38,13 @@ class AdoptSolver(ConfigurablePropertySolverMixin): ...@@ -35,8 +38,13 @@ class AdoptSolver(ConfigurablePropertySolverMixin):
meta_type = 'ERP5 Adopt Solver' meta_type = 'ERP5 Adopt Solver'
portal_type = 'Adopt Solver' portal_type = 'Adopt Solver'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# ISolver Implementation # ISolver Implementation
# XXX-Leo: Needs security declaration! It's currently public. security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, activate_kw=None): def solve(self, activate_kw=None):
""" """
Adopt new property to movements or deliveries. Adopt new property to movements or deliveries.
......
...@@ -31,6 +31,7 @@ import zope.interface ...@@ -31,6 +31,7 @@ import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.mixin.solver import SolverMixin from Products.ERP5.mixin.solver import SolverMixin
from Products.ERP5.mixin.configurable import ConfigurableMixin from Products.ERP5.mixin.configurable import ConfigurableMixin
...@@ -65,6 +66,8 @@ class ItemListSplitSolver(SolverMixin, ConfigurableMixin, XMLObject): ...@@ -65,6 +66,8 @@ class ItemListSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
) )
# ISolver Implementation # ISolver Implementation
security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, activate_kw=None): def solve(self, activate_kw=None):
"""This method create new movement based on difference of aggregate sets. """This method create new movement based on difference of aggregate sets.
It supports only removed items. It supports only removed items.
......
...@@ -59,6 +59,8 @@ class MovementSplitSolver(SolverMixin, ConfigurableMixin, XMLObject): ...@@ -59,6 +59,8 @@ class MovementSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
) )
# ISolver Implementation # ISolver Implementation
security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, activate_kw=None): def solve(self, activate_kw=None):
""" """
This method splits a Delivery and move movements in to a new This method splits a Delivery and move movements in to a new
......
...@@ -31,6 +31,7 @@ import zope.interface ...@@ -31,6 +31,7 @@ import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Globals import PersistentMapping from Products.ERP5Type.Globals import PersistentMapping
from Products.ERP5.mixin.solver import SolverMixin from Products.ERP5.mixin.solver import SolverMixin
...@@ -66,6 +67,8 @@ class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject): ...@@ -66,6 +67,8 @@ class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
) )
# ISolver Implementation # ISolver Implementation
security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, activate_kw=None): def solve(self, activate_kw=None):
""" """
""" """
......
...@@ -30,6 +30,7 @@ from AccessControl import ClassSecurityInfo ...@@ -30,6 +30,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.ERP5Type import ERP5TypeInformation from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5Type.Core.Predicate import Predicate from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
class SolverTypeInformation(Predicate, ERP5TypeInformation): class SolverTypeInformation(Predicate, ERP5TypeInformation):
""" """
...@@ -214,6 +215,8 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation): ...@@ -214,6 +215,8 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation):
method = getattr(solver, method_id) method = getattr(solver, method_id)
return method() return method()
security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, delivery_list=None, configuration_dict=None, def solve(self, delivery_list=None, configuration_dict=None,
activate_kw=None, **kw): activate_kw=None, **kw):
if delivery_list is None: if delivery_list is None:
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5.Document.AcceptSolver import AcceptSolver from Products.ERP5.Document.AcceptSolver import AcceptSolver
class TradeModelSolver(AcceptSolver): class TradeModelSolver(AcceptSolver):
...@@ -58,6 +59,8 @@ class TradeModelSolver(AcceptSolver): ...@@ -58,6 +59,8 @@ class TradeModelSolver(AcceptSolver):
zope.interface.implements(interfaces.ISolver,) zope.interface.implements(interfaces.ISolver,)
# ISolver Implementation # ISolver Implementation
security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, activate_kw=None): def solve(self, activate_kw=None):
""" """
Adopt new values to simulation movements, with keeping the original Adopt new values to simulation movements, with keeping the original
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
import zope.interface import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5.Document.AcceptSolver import AcceptSolver from Products.ERP5.Document.AcceptSolver import AcceptSolver
class UnifySolver(AcceptSolver): class UnifySolver(AcceptSolver):
...@@ -90,6 +91,8 @@ class UnifySolver(AcceptSolver): ...@@ -90,6 +91,8 @@ class UnifySolver(AcceptSolver):
return simulation_movement_list return simulation_movement_list
# ISolver Implementation # ISolver Implementation
security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, activate_kw=None): def solve(self, activate_kw=None):
""" """
Adopt new property value to simulation movements and their deliveries, Adopt new property value to simulation movements and their deliveries,
......
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