[Checkins] SVN: z3c.securitytool/trunk/src/z3c/securitytool/ Cleanup of securityMatrix styles and layout

Daniel Blackburn blackburnd at gmail.com
Mon Feb 11 19:45:55 EST 2008


Log message for revision 83756:
  Cleanup of securityMatrix styles and layout

Changed:
  U   z3c.securitytool/trunk/src/z3c/securitytool/browser/securitytool.css
  U   z3c.securitytool/trunk/src/z3c/securitytool/browser/viewprincipalmatrix.pt
  U   z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py

-=-
Modified: z3c.securitytool/trunk/src/z3c/securitytool/browser/securitytool.css
===================================================================
--- z3c.securitytool/trunk/src/z3c/securitytool/browser/securitytool.css	2008-02-12 00:22:28 UTC (rev 83755)
+++ z3c.securitytool/trunk/src/z3c/securitytool/browser/securitytool.css	2008-02-12 00:45:54 UTC (rev 83756)
@@ -96,6 +96,16 @@
     font-weight : bold;
 }
 
+.view_perm {
+    padding-left: 2em;
+    text-align: left;
+}
+
+.viewObj {
+    font-weight : bold;
+}
+
+
 .view{
     text-align : left;
 }
@@ -104,10 +114,15 @@
     font-style:italic;
 }
 
-.even {
+.odd {
+    padding-left: 3em;
     background-color: #ddd;
 }
 
+.even {
+    padding-left: 3em;
+}
+
 .contentList {
     margin-left: 3em;
 }

Modified: z3c.securitytool/trunk/src/z3c/securitytool/browser/viewprincipalmatrix.pt
===================================================================
--- z3c.securitytool/trunk/src/z3c/securitytool/browser/viewprincipalmatrix.pt	2008-02-12 00:22:28 UTC (rev 83755)
+++ z3c.securitytool/trunk/src/z3c/securitytool/browser/viewprincipalmatrix.pt	2008-02-12 00:45:54 UTC (rev 83756)
@@ -64,7 +64,7 @@
                     tal:attributes="class view/cssclass">
           <tr>
             <th align="left" valign="bottom" >
-               <h2 tal:content="python: viewObj"/>
+               <div class="viewObj" tal:content="python: viewObj"/>
             </th>
             <th tal:attributes="colspan python:len(view.viewMatrix)">
               &nbsp
@@ -73,8 +73,8 @@
           </tr>
 
           <tr tal:repeat="viewItem python: view.viewList[viewObj]"
-               tal:attributes="class view/cssclass">
-               <td tal:content="viewItem" style="text-align: left"/>
+              tal:attributes="class view/cssclass" >
+               <td tal:content="viewItem" class="view_perm"/>
                 <metal:block tal:repeat="principal view/viewMatrix">
                 <td tal:define="enc python:urlViewName[viewItem];
                    perm python: view.getPermissionSetting(viewItem,principal)">

Modified: z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py
===================================================================
--- z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py	2008-02-12 00:22:28 UTC (rev 83755)
+++ z3c.securitytool/trunk/src/z3c/securitytool/securitytool.py	2008-02-12 00:45:54 UTC (rev 83756)
@@ -73,9 +73,12 @@
                     self.populateMatrix(viewInstance,view_reg)
 
         # Two matricies are created a role matrix and a permission matrix.
-        # we have two so lower roles in the tree can overite higher roles.
-        # and leave the permission settings intact.
 
+        # The reason for the viewRoleMatrix is so lower roles in the tree
+        # can overite higher roles. And the assigned permissions in roles
+        # can be organized seperately than the assigned permissions to
+        # objects.
+
         # Here we will merge the two matricies where the permission matrix
         # will always win
 
@@ -96,18 +99,16 @@
         return [self.viewMatrix,self.views,self.permissions]
 
     def getReadPerm(self,view_reg):
+        """ Helper method which returns read_perm and view name"""
         info = getViewInfoDictionary(view_reg)
-
         read_perm = info['read_perm']
         if read_perm == None:
             read_perm = 'zope.Public'
         self.permissions.add(read_perm)
-
         name = info['name']
         self.views[name] = read_perm
 
         return name, read_perm
-        
 
     def populateMatrix(self,viewInstance,view_reg):
         """ populates the matrix used for the securityMatrix view"""
@@ -132,7 +133,10 @@
 
                 elif role['setting'] == Deny:
                     try:
-                        del self.viewRoleMatrix[principal][self.name][role['role']]
+                        # Here we see if we have added a security setting with
+                        # this role before, if it is now denied we remove it.
+                        del self.viewRoleMatrix[principal]\
+                                       [self.name][role['role']]
                     except KeyError:
                         pass
                     continue



More information about the Checkins mailing list