• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

allura


Commit MetaInfo

Revisãoe920bc6da262b6b0f4323be09581f2958b4c593a (tree)
Hora2012-07-13 05:08:29
AutorCory Johns <johnsca@geek...>
CommiterCory Johns

Mensagem de Log

[#3892] Moved ACL.add method as ACL instances are not of the ACL class

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

Mudança Sumário

Diff

--- a/Allura/allura/model/types.py
+++ b/Allura/allura/model/types.py
@@ -44,8 +44,4 @@ 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-
5147 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
@@ -14,6 +14,10 @@ from forgewiki.wiki_main import ForgeWikiApp
1414 log = logging.getLogger(__name__)
1515
1616
17+def add(acl, role):
18+ if role not in acl:
19+ acl.append(role)
20+
1721 # migration script for change write permission to create + update
1822 def main():
1923 query = {'tool_name': {'$regex': '^tickets$', '$options': 'i'}}
@@ -23,11 +27,11 @@ def main():
2327 role_ids = [(p.role_id, p.access) for p in a.acl if p.permission == 'write']
2428 for role_id, access in role_ids:
2529 if access == M.ACE.DENY:
26- a.acl.add(M.ACE.deny(role_id, 'create'))
27- a.acl.add(M.ACE.deny(role_id, 'update'))
30+ add(a.acl, M.ACE.deny(role_id, 'create'))
31+ add(a.acl, M.ACE.deny(role_id, 'update'))
2832 else:
29- a.acl.add(M.ACE.allow(role_id, 'create'))
30- a.acl.add(M.ACE.allow(role_id, 'update'))
33+ add(a.acl, M.ACE.allow(role_id, 'create'))
34+ add(a.acl, M.ACE.allow(role_id, 'update'))
3135
3236 ThreadLocalORMSession.flush_all()
3337