From 37007ea9a4f09dba04c84b45439e7eae062b2978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 3 May 2006 16:02:29 +0000 Subject: [PATCH] Set permissions when adding Simulation Tool git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7070 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Tool/SimulationTool.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py index 0a0756a57e..c971e0292d 100644 --- a/product/ERP5/Tool/SimulationTool.py +++ b/product/ERP5/Tool/SimulationTool.py @@ -86,10 +86,6 @@ class SimulationTool (BaseTool): security.declareProtected( Permissions.ManagePortal, 'manage_overview' ) manage_overview = DTMLFile( 'explainSimulationTool', _dtmldir ) - # Filter content (ZMI)) - #def __init__(self): - # return Folder.__init__(self, SimulationTool.id) - # Filter content (ZMI)) def filtered_meta_types(self, user=None): # Filters the list of available meta types. @@ -103,6 +99,23 @@ class SimulationTool (BaseTool): def tpValues(self) : """ show the content in the left pane of the ZMI """ return self.objectValues() + + security.declarePrivate('manage_afterAdd') + def manage_afterAdd(self, item, container) : + """Init permissions right after creation. + + Permissions in simulation tool are simple: + o Each member can access and create some content. + o Only manager can view, because simulation can be seen as + sensitive information. + """ + item.manage_permission(Permissions.AddPortalContent, + ['Member', 'Author', 'Manager']) + item.manage_permission(Permissions.AccessContentsInformation, + ['Member', 'Auditor', 'Manager']) + item.manage_permission(Permissions.View, + ['Manager',]) + BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container) def solveDelivery(self, delivery, dsolver_name, tsolver_name, additional_parameters=None,**kw): -- 2.30.9