Commit ff624fd2 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

ERP5Workflow: newly added permission should be acquired for all existing states.

before, all permissions became acquired in all states once we update permission list.
parent 9669af24
Pipeline #37840 failed with stage
in 0 seconds
......@@ -173,12 +173,17 @@ class TestERP5Workflow(ERP5TypeTestCase):
state1.getStatePermissionRoleListDict(),
{k: () for k in permission_list},
)
state1.setAcquirePermissionList(['View'])
state1.setStatePermissionRoleListDict(
{k: ['Assignor', 'Manager'] for k in permission_list},
)
workflow.setWorkflowManagedPermissionList(
permission_list + ['Delete objects']
)
self.assertEqual(
state1.getAcquirePermissionList(),
['View', 'Delete objects'],
)
self.assertEqual(
state1.getStatePermissionRoleListDict(),
{
......
......@@ -1440,11 +1440,15 @@ class Workflow(XMLObject):
return res
def _setWorkflowManagedPermissionList(self, permission_list):
current_permission_list = self.getWorkflowManagedPermissionList()
self._baseSetWorkflowManagedPermission(permission_list)
# Add/remove the added/removed Workflow permissions to each state
for state in self.getStateValueList():
state.setAcquirePermissionList(permission_list)
state.setAcquirePermissionList(
[e for e in state.getAcquirePermissionList() if e in permission_list] + \
list(set(permission_list) - set(current_permission_list))
)
permission_role_list_dict = state.getStatePermissionRoleListDict()
state.setStatePermissionRoleListDict({
......
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