• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revision9424e550b02cf4a711272eafbaef55e031323ac2 (tree)
Zeit2012-07-12 03:04:35
AutorCory Johns <johnsca@geek...>
CommiterCory Johns

Log Message

[#3892] Do not duplicate CREATE and UPDATE permission of migration 027 is re-run

Signed-off-by: Cory Johns <johnsca@geek.net>

Ändern Zusammenfassung

Diff

--- a/Allura/allura/model/types.py
+++ b/Allura/allura/model/types.py
@@ -44,4 +44,8 @@ class ACL(S.Array):
4444 super(ACL, self).__init__(
4545 field_type=ACE(permissions), **kwargs)
4646
47+ def add(self, role):
48+ if role not in self:
49+ self.append(role)
50+
4751 DENY_ALL = ACE.deny(EVERYONE, ALL_PERMISSIONS)
--- a/scripts/migrations/027-change-ticket-write-permissions.py
+++ b/scripts/migrations/027-change-ticket-write-permissions.py
@@ -23,11 +23,11 @@ def main():
2323 role_ids = [(p.role_id, p.access) for p in a.acl if p.permission == 'write']
2424 for role_id, access in role_ids:
2525 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'))
2828 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'))
3131
3232 ThreadLocalORMSession.flush_all()
3333