Commit 09ed876e authored by iv's avatar iv

ERP5Workflow: change setWorkflowManagedPermissionList to impact states

state_permission_roles attributes should be updated when the permission list is changed on the workflow
it also fix matrixbox edition (was crashing when permissions where added)
parent 7593486a
...@@ -1120,3 +1120,19 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject): ...@@ -1120,3 +1120,19 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
if state_var is not None: if state_var is not None:
res[state_var] = status.get(state_var, initial_state) res[state_var] = status.get(state_var, initial_state)
return res return res
def _setWorkflowManagedPermissionList(self, permission_list):
self.workflow_managed_permission = permission_list
# add/remove the added/removed workflow permission to each state
for state in self.objectValues(portal_type='State'):
state.setCellRange(sorted(permission_list),
sorted(self.getManagedRoleList()),
base_id='cell')
for permission in permission_list:
if permission not in state.state_permission_roles:
state.state_permission_roles[permission] = []
# remove permission from state_permission_roles dict
for permission in state.state_permission_roles.keys():
if permission not in permission_list:
del state.state_permission_roles[permission]
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