From 406db0e441f4a4dbd178459bbb33d33ac8cde264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 28 Nov 2005 18:23:18 +0000 Subject: [PATCH] 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 --- product/ERP5Type/ZopePatch.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/product/ERP5Type/ZopePatch.py b/product/ERP5Type/ZopePatch.py index 81d2c3a113..e0829667a6 100755 --- a/product/ERP5Type/ZopePatch.py +++ b/product/ERP5Type/ZopePatch.py @@ -662,23 +662,30 @@ def updateRoleMappingsFor(self, ob): other_data_list.append((other_workflow,other_sdef)) # 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: for p in self.permissions: roles = [] + refused_roles = [] role_type = 'list' if sdef.permission_roles is not None: roles = sdef.permission_roles.get(p, roles) if type(roles) is type(()): - role_type='tuple' + role_type = 'tuple' roles = list(roles) # We will check that each role is activated # in each DCWorkflow for other_workflow,other_sdef in other_data_list: if p in other_workflow.permissions: for role in roles: - if role not in other_sdef.permission_roles.get(p,[]): - roles.remove(role) + other_roles = other_sdef.permission_roles.get(p, ()) + 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': roles = tuple(roles) if modifyRolesForPermission(ob, p, roles): -- 2.30.9