[Checkins] SVN: z3c.securitytool/trunk/src/z3c/securitytool/ Added some sorting for the principaldetails view and removed some old comments from securitytool.py

Daniel Blackburn blackburnd at gmail.com
Mon Feb 18 09:34:40 EST 2008


Log message for revision 84022:
  Added some sorting for the principaldetails view and removed some old comments from securitytool.py

Changed:
  U   z3c.securitytool/trunk/src/z3c/securitytool/browser/views.py
  U   z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py

-=-
Modified: z3c.securitytool/trunk/src/z3c/securitytool/browser/views.py
===================================================================
--- z3c.securitytool/trunk/src/z3c/securitytool/browser/views.py	2008-02-18 13:36:48 UTC (rev 84021)
+++ z3c.securitytool/trunk/src/z3c/securitytool/browser/views.py	2008-02-18 14:34:39 UTC (rev 84022)
@@ -163,7 +163,24 @@
                        u"</span>,<span class='Allow'> Green Normal = "
                        u"Allowed Permission </span>")
 
+        self.preparePrincipalPermissions()
 
+    def preparePrincipalPermissions(self):
+        permTree = self.principalPermissions['permissionTree']
+        for idx, item in enumerate(permTree):
+            for uid,value in item.items():
+                if value.has_key('permissions'):
+                    self.principalPermissions['permissionTree']\
+                                      [idx][uid]['permissions'].sort()
+
+        permTree = self.principalPermissions['roleTree']
+        for idx, item in enumerate(permTree):
+            for uid,value in item.items():
+                if value.has_key('roles'):
+                    self.principalPermissions['roleTree']\
+                                      [idx][uid]['roles'].sort()
+
+
     def render(self):
         return ViewPageTemplateFile(self.pageTemplateFile)(self)
 

Modified: z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py
===================================================================
--- z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py	2008-02-18 13:36:48 UTC (rev 84021)
+++ z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py	2008-02-18 14:34:39 UTC (rev 84022)
@@ -8,8 +8,6 @@
 from zope.i18nmessageid import ZopeMessageFactory as _
 from zope.app.security.principalregistry import PrincipalRegistry
 
-# The following imports are just so we can have the Duplicate
-# settingsForObject without the sort call on settings
 from zope.securitypolicy.interfaces import IPrincipalPermissionMap
 from zope.securitypolicy.interfaces import IPrincipalRoleMap
 from zope.securitypolicy.interfaces import IRolePermissionMap
@@ -543,9 +541,7 @@
 def settingsForObject(ob):
     """Analysis tool to show all of the grants to a process
        This method was copied from zopepolicy.py in the zope.
-       security policy package. This method was copied becuase
-       sort is a protected method and unavailable when traversing
-       to the` __parent__` objects. Also needed to add a parentList
+       security policy package.  Also needed to add a parentList
        this just helps locate the object when we display it to the
        user.
     """



More information about the Checkins mailing list