Commit 406db0e4 authored by Jérome Perrin's avatar Jérome Perrin

When doing the logical AND on all workflow defined permission, "do not...

When doing the logical AND on all workflow defined permission, "do not acquire" should be the default.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4413 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 356100f7
...@@ -662,23 +662,30 @@ def updateRoleMappingsFor(self, ob): ...@@ -662,23 +662,30 @@ def updateRoleMappingsFor(self, ob):
other_data_list.append((other_workflow,other_sdef)) other_data_list.append((other_workflow,other_sdef))
# Be carefull, permissions_roles should not change # Be carefull, permissions_roles should not change
# from list to tuple or vice-versa # from list to tuple or vice-versa. (in modifyRolesForPermission,
# list means acquire roles, tuple means do not acquire)
if sdef is not None and self.permissions: if sdef is not None and self.permissions:
for p in self.permissions: for p in self.permissions:
roles = [] roles = []
refused_roles = []
role_type = 'list' role_type = 'list'
if sdef.permission_roles is not None: if sdef.permission_roles is not None:
roles = sdef.permission_roles.get(p, roles) roles = sdef.permission_roles.get(p, roles)
if type(roles) is type(()): if type(roles) is type(()):
role_type='tuple' role_type = 'tuple'
roles = list(roles) roles = list(roles)
# We will check that each role is activated # We will check that each role is activated
# in each DCWorkflow # in each DCWorkflow
for other_workflow,other_sdef in other_data_list: for other_workflow,other_sdef in other_data_list:
if p in other_workflow.permissions: if p in other_workflow.permissions:
for role in roles: for role in roles:
if role not in other_sdef.permission_roles.get(p,[]): other_roles = other_sdef.permission_roles.get(p, ())
roles.remove(role) if type(other_roles) is type(()) :
role_type = 'tuple'
if role not in other_roles :
refused_roles.append(role)
for role in refused_roles :
roles.remove(role)
if role_type=='tuple': if role_type=='tuple':
roles = tuple(roles) roles = tuple(roles)
if modifyRolesForPermission(ob, p, roles): if modifyRolesForPermission(ob, p, roles):
......
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