allura
Revision | 9424e550b02cf4a711272eafbaef55e031323ac2 (tree) |
---|---|
Zeit | 2012-07-12 03:04:35 |
Autor | Cory Johns <johnsca@geek...> |
Commiter | Cory Johns |
[#3892] Do not duplicate CREATE and UPDATE permission of migration 027 is re-run
Signed-off-by: Cory Johns <johnsca@geek.net>
@@ -44,4 +44,8 @@ class ACL(S.Array): | ||
44 | 44 | super(ACL, self).__init__( |
45 | 45 | field_type=ACE(permissions), **kwargs) |
46 | 46 | |
47 | + def add(self, role): | |
48 | + if role not in self: | |
49 | + self.append(role) | |
50 | + | |
47 | 51 | DENY_ALL = ACE.deny(EVERYONE, ALL_PERMISSIONS) |
@@ -23,11 +23,11 @@ def main(): | ||
23 | 23 | role_ids = [(p.role_id, p.access) for p in a.acl if p.permission == 'write'] |
24 | 24 | for role_id, access in role_ids: |
25 | 25 | if access == M.ACE.DENY: |
26 | - a.acl.append(M.ACE.deny(role_id, 'create')) | |
27 | - a.acl.append(M.ACE.deny(role_id, 'update')) | |
26 | + a.acl.add(M.ACE.deny(role_id, 'create')) | |
27 | + a.acl.add(M.ACE.deny(role_id, 'update')) | |
28 | 28 | else: |
29 | - a.acl.append(M.ACE.allow(role_id, 'create')) | |
30 | - a.acl.append(M.ACE.allow(role_id, 'update')) | |
29 | + a.acl.add(M.ACE.allow(role_id, 'create')) | |
30 | + a.acl.add(M.ACE.allow(role_id, 'update')) | |
31 | 31 | |
32 | 32 | ThreadLocalORMSession.flush_all() |
33 | 33 |