[Checkins] SVN: z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py Fixed issue where the main page would incorrectly display the permissions for the views, this was because I was not overriding the permissions found at a lower level. The other pages did not suffer from this feature

Daniel Blackburn blackburnd at gmail.com
Thu Jun 12 19:31:34 EDT 2008


Log message for revision 87355:
  Fixed issue where the main page would incorrectly display the permissions for the views, this was because I was not overriding the permissions found at a lower level. The other pages did not suffer from this feature

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

-=-
Modified: z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py
===================================================================
--- z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py	2008-06-12 22:01:56 UTC (rev 87354)
+++ z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py	2008-06-12 23:31:32 UTC (rev 87355)
@@ -70,6 +70,7 @@
 
         # Populate the viewMatrix with the permissions gained from the
         # assigned roles
+
         for item in self.viewRoleMatrix:
             if not  self.viewMatrix.has_key(item):
                 self.viewMatrix[item] = {}
@@ -78,6 +79,7 @@
                                                and 'Allow' or '--'
                 self.viewMatrix[item].update({viewSetting:val})
 
+
         # Populate the viewMatrix with the permissions directly assinged.
         for item in self.viewPermMatrix:
             if not  self.viewMatrix.has_key(item):
@@ -86,6 +88,7 @@
                 self.viewMatrix[item].update(
                       {viewSetting:self.viewPermMatrix[item][viewSetting]})
 
+
         # Now we will inherit the permissions from groups assigned to each
         # principal and digest them accordingly
         principals = zapi.principals()
@@ -178,7 +181,6 @@
         matrix = self.viewPermMatrix
         principalPermissions.reverse()
 
-
         for prinPerm in principalPermissions:
             if prinPerm['permission'] != read_perm:
                 #If it is not the read_perm it is uninteresting
@@ -192,7 +194,9 @@
                 #If the principal_id is not in the matrix add it
                 continue
 
-            elif  matrix[principal_id].setdefault(
-                         self.name,setting) == setting:
-                #If the permisison does not exist for the prin add it
-                continue
+            else:
+                # This is now the permission for this view
+                # since we reversed the list we are travering
+                # from the root level to our current level
+                # so anything we find here we keep.
+                matrix[principal_id][self.name] = setting



More information about the Checkins mailing list