Commit 738b7e0c authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_core: fix "Update Security Roles" on workflow

See merge request nexedi/erp5!1469
parents 1c1ec0bc bdc67d95
Pipeline #16741 failed with stage
in 0 seconds
......@@ -414,6 +414,21 @@ class TestConvertedWorkflow(TestERP5WorkflowMixin):
# check worklist view is available on workflow
self.workflow.worklist_1_draft_test_workflow_document_list.view()
def test_17_testUpdateSecurityRole(self):
text_document = self.getTestObject()
self.assertEqual(text_document._View_Permission, ('Assignee', 'Assignor', 'Associate', 'Auditor', 'Author', 'Manager', 'Owner'))
self.assertEqual(text_document.getValidationState(), 'draft')
default_role_dict = self.workflow.state_draft.getStatePermissionRoleListDict()
modified_role_dict = default_role_dict.copy()
modified_role_dict['View'] = ('Assignee', 'Assignor', 'Associate', 'Auditor', 'Author', 'Manager')
self.workflow.state_draft.setStatePermissionRoleListDict(modified_role_dict)
self.tic()
self.workflow.Workflow_updateSecurityRoles()
self.tic()
self.assertEqual(text_document._View_Permission, ('Assignee', 'Assignor', 'Associate', 'Auditor', 'Author', 'Manager'))
self.workflow.state_draft.setStatePermissionRoleListDict(default_role_dict)
self.tic()
class TestDCWorkflow(TestERP5WorkflowMixin):
"""
Check DC Workflow works correctly in new Workflow Tool.
......
......@@ -3,17 +3,7 @@ def updateRoleMappings(self, REQUEST=None):
"""
Changes permissions of all objects related to this workflow
"""
# XXX(WORKFLOW) add test for roles update:
# - edit permission/roles on a workflow
# - check permission on an existing object of a type using this workflow
type_info_list = self.getParentValue()._listTypeInfo()
workflow_id = self.getId()
# check the workflow defined on the type objects
portal_type_id_list = [
portal_type.getId() for portal_type in type_info_list
if workflow_id in portal_type.getTypeWorkflowList()
]
portal_type_id_list = self.getPortalTypeListForWorkflow()
if portal_type_id_list:
object_list = self.portal_catalog(portal_type=portal_type_id_list, limit=None)
portal_activities = self.portal_activities
......
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