Commit 9d710981 authored by Nicolas Wavrant's avatar Nicolas Wavrant

code factorization for security permissions in Solvers

parent e447832e
master after_rebase allow_login_change allow_login_change_differentiate_id_and_login allow_login_change_wip arnau bt5_config cherry-pick-4a8e045d cleanup_acquisition_base_category compact_title_no_reference cr_test cr_test_rebase delivery_item_barcode dsn-phase3 eos-dev erp5-component erp5-vifib erp5-vifib-cleanup erp5_catalog erp5testnode_max_timeout experiment/coding_style_test_suite feat/accounting_balance_sheet_profit_and_loss_cleanups feat/accounting_stop_using_getObject feat/accounting_translate_gap feat/no_useless_records_in_predicate_table feat/olapy feat/trade_shipment_report feat/wendelin-py-data feature/renderjs-formbox feature/renderjs-matrixbox feature/renderjs-ui-no-header fix/full_text_script_conflict fix/login_validate_check_consistency fix/repair_graph_editor fix/xvfb_all_displays_locked for_testrunner_1 for_testrunner_2 for_testrunner_3 gadget-json-value isDeletable item_tracking_graph_editor jm/form-action-guard joblib-activity maste_copy master_calendar_wip_patches master_calendar_wip_patches_extend_security master_no_guard_on_workflow_transition master_no_guard_on_workflow_transition_plus_calendar_wip_patchs monitoring no_longer_simulated_state officejs_clean officejs_zip portal_callables portal_solver_process_security_configuration reindex_calendar_after_change_calendar_exception reverse_logistics rewrite_test_21_AcquiredPortalType sms_more_than_140_characters sws_fix taskdistribution-xmlrpc-binary tmp/getInstalledBusinessTemplate_never_installed_bt tristan-merge view-aggregated-amounts erp5.util-0.4.49 erp5.util-0.4.46 erp5.util-0.4.44
No related merge requests found
......@@ -29,7 +29,6 @@
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):
......@@ -42,10 +41,7 @@ class AcceptSolver(ConfigurablePropertySolverMixin):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# ISolver Implementation
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
original one recorded.
......
......@@ -29,7 +29,6 @@
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):
......@@ -42,10 +41,7 @@ class AdoptSolver(ConfigurablePropertySolverMixin):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# ISolver Implementation
security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, activate_kw=None):
def _solve(self, activate_kw=None):
"""
Adopt new property to movements or deliveries.
"""
......
......@@ -31,7 +31,6 @@ 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,10 +64,7 @@ class ItemListSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
interfaces.IConfigurable,
)
# 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.
It supports only removed items.
Quantity divergence is also solved with sum of aggregated quantities stored
......
......@@ -58,10 +58,7 @@ class MovementSplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
interfaces.IConfigurable,
)
# 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
Delivery. Splitting is done by duplicating the Delivery, removing
......
......@@ -31,7 +31,6 @@ 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
......@@ -67,9 +66,7 @@ class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
)
# ISolver Implementation
security.declarePrivate('solve')
@UnrestrictedMethod
def solve(self, activate_kw=None):
def _solve(self, activate_kw=None):
"""
"""
configuration_dict = self.getConfigurationPropertyDict()
......
......@@ -29,7 +29,6 @@
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,10 +57,7 @@ class TradeModelSolver(AcceptSolver):
# Declarative interfaces
zope.interface.implements(interfaces.ISolver,)
# 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
one recorded, and then update Trade Model related lines accordingly.
......
......@@ -30,7 +30,6 @@
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,10 +89,7 @@ class UnifySolver(AcceptSolver):
simulation_movement_list.append(simulation_movement)
return simulation_movement_list
# 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,
while keeping the original one recorded.
......
......@@ -30,6 +30,7 @@
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.UnrestrictedMethod import super_user
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.mixin.configurable import ConfigurableMixin
......@@ -44,7 +45,14 @@ class SolverMixin(object):
# Declarative interfaces
zope.interface.implements(interfaces.ISolver,)
def _solve(self, activate_kw=None):
raise NotImplementedError
# Implementation of ISolver
security.declarePrivate('solve')
def solve(self, activate_kw=None):
with super_user():
self._solve(activate_kw=activate_kw)
def getPortalTypeValue(self):
return self.getPortalObject().portal_solvers._getOb(self.getPortalType())
......
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