diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/delete_action.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/delete_action.xml index cf6ab50f8ac2059f87304d4c9318a734d18296ca..9b424b595f19726a964e239da34cd670755cad49 100644 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/delete_action.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/delete_action.xml @@ -69,9 +69,7 @@ <key> <string>roles</string> </key> <value> <tuple> - <string>Assignee</string> - <string>Assignor</string> - <string>Manager</string> + <string>Developer</string> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/invalidate_action.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/invalidate_action.xml index c66a5b58bcdfa4d5da383ae7972f329b701601ce..f89fd61c0dbc59d0b712dd4ec9728850297cb7bf 100644 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/invalidate_action.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/invalidate_action.xml @@ -65,9 +65,7 @@ <key> <string>roles</string> </key> <value> <tuple> - <string>Assignee</string> - <string>Assignor</string> - <string>Manager</string> + <string>Developer</string> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/validate_action.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/validate_action.xml index e5c515feddbb37cf53b4b21cf9d803e100f65c41..bfc54c143c4cfd15284c3165810c13e8d8a026dd 100644 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/validate_action.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/validate_action.xml @@ -65,9 +65,7 @@ <key> <string>roles</string> </key> <value> <tuple> - <string>Assignee</string> - <string>Assignor</string> - <string>Manager</string> + <string>Developer</string> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_core/bt/change_log b/product/ERP5/bootstrap/erp5_core/bt/change_log index db8c9a11a678c1315fe973d55f1d57268c482e66..bcba20f6a8867e3ed586f327a2c76ee89b06c958 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/change_log +++ b/product/ERP5/bootstrap/erp5_core/bt/change_log @@ -1,3 +1,6 @@ +2013-07-09 arnaud.fontaine +* ZODB Components: Only Developer Role must be able to invalidate/delete/validate Components. + 2013-07-04 arnaud.fontaine * ZODB Components: Version was not displayed properly in Component view. diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 7205cba6b1a5775c308851546c434ffe44751ba1..bc6c786a74833c77931defbea43e6cd9115eb969 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -41104 \ No newline at end of file +41105 \ No newline at end of file diff --git a/product/ERP5Type/tests/testDynamicClassGeneration.py b/product/ERP5Type/tests/testDynamicClassGeneration.py index 6e813ae12a38e16915fd5ef7b15a4fd3c462d4b9..3d5c825d6634b875729ddfd53639bcf4187e69ce 100644 --- a/product/ERP5Type/tests/testDynamicClassGeneration.py +++ b/product/ERP5Type/tests/testDynamicClassGeneration.py @@ -1348,26 +1348,75 @@ class _TestZodbComponent(SecurityTestCase): The new Component should only be in erp5.component.XXX when validated, otherwise it should not be importable at all """ + uf = self.portal.acl_users + if not uf.getUser('ERP5TypeTestCase_NonDeveloper'): + uf._doAddUser('ERP5TypeTestCase_NonDeveloper', + '', ['Manager', 'Member', 'Assignee', + 'Assignor', 'Author', 'Auditor', 'Associate'], []) + test_component = self._newComponent( 'TestValidateInvalidateComponent', 'def foobar(*args, **kwargs):\n return "ValidateInvalidate"') - test_component.validate() + self.failIfUserCanPassWorkflowTransition('ERP5TypeTestCase_NonDeveloper', + 'validate_action', + test_component) + + self.failIfUserCanPassWorkflowTransition('ERP5TypeTestCase', + 'invalidate_action', + test_component) + + from AccessControl.SecurityManagement import getSecurityManager + from AccessControl.SecurityManagement import setSecurityManager + from Products.CMFCore.WorkflowCore import WorkflowException + sm = getSecurityManager() + try: + self._loginAsUser('ERP5TypeTestCase_NonDeveloper') + self.assertRaises(WorkflowException, + self.portal.portal_workflow.doActionFor, + test_component, 'delete_action') + finally: + setSecurityManager(sm) + + self.failIfModuleImportable('TestValidateInvalidateComponent') + self.portal.portal_workflow.doActionFor(test_component, 'validate_action') self.tic() self.assertModuleImportable('TestValidateInvalidateComponent') - test_component.invalidate() + + self.failIfUserCanPassWorkflowTransition('ERP5TypeTestCase_NonDeveloper', + 'invalidate_action', + test_component) + + self.failIfUserCanPassWorkflowTransition('ERP5TypeTestCase', + 'validate_action', + test_component) + + self.assertRaises(WorkflowException, + self.portal.portal_workflow.doActionFor, + test_component, 'delete_action') + + self.portal.portal_workflow.doActionFor(test_component, 'invalidate_action') self.tic() self.failIfModuleImportable('TestValidateInvalidateComponent') - test_component.validate() + self.portal.portal_workflow.doActionFor(test_component, 'validate_action') self.tic() self.assertModuleImportable('TestValidateInvalidateComponent') - test_component.invalidate() + self.portal.portal_workflow.doActionFor(test_component, 'invalidate_action') self.tic() self.failIfModuleImportable('TestValidateInvalidateComponent') + sm = getSecurityManager() + try: + self._loginAsUser('ERP5TypeTestCase_NonDeveloper') + self.assertRaises(WorkflowException, + self.portal.portal_workflow.doActionFor, + test_component, 'delete_action') + finally: + setSecurityManager(sm) + self.portal.portal_workflow.doActionFor(test_component, 'delete_action') self.tic() self.failIfModuleImportable('TestValidateInvalidateComponent')