Commit ae1c3380 authored by Nicolas Wavrant's avatar Nicolas Wavrant

make solve functions of solvers private and unrestricted

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