[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - AttributeRolePermissionManager.py:1.1.2.7 RolePermissionManager.py:1.1.2.9 RolePermissionView.py:1.1.2.7

Steve Alexander steve@cat-box.net
Fri, 15 Feb 2002 14:15:36 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv3201/lib/python/Zope/App/Security

Modified Files:
      Tag: Zope-3x-branch
	AttributeRolePermissionManager.py RolePermissionManager.py 
	RolePermissionView.py 
Log Message:
Fixed typos in unsetPermissionForRole --> unsetPermissionFromRole, to bring in line with interface IRolePermissionManager.
Fixed Permission-Role mapping UI in line with new LocalRoles/Permissions changes.



=== Zope3/lib/python/Zope/App/Security/AttributeRolePermissionManager.py 1.1.2.6 => 1.1.2.7 ===
         self._context._p_changed = 1
 
-    def unsetPermissionForRole( self, permission_id, role_id ):
+    def unsetPermissionFromRole( self, permission_id, role_id ):
         ''' See the interface IRolePermissionManager '''
         pp = self._getRolePermissions()
         # Only unset if there is a security map, otherwise, we're done


=== Zope3/lib/python/Zope/App/Security/RolePermissionManager.py 1.1.2.8 => 1.1.2.9 ===
         self.addCell( permission_id, role_id, Deny )
 
-    def unsetPermissionForRole( self, permission_id, role_id ):
+    def unsetPermissionFromRole( self, permission_id, role_id ):
         '''See interface IRolePermissionMap'''
         self.delCell( permission_id, role_id )
 


=== Zope3/lib/python/Zope/App/Security/RolePermissionView.py 1.1.2.6 => 1.1.2.7 ===
                     prm.grantPermissionToRole(rperm, rrole)
                 else:
-                    prm.retractPermissionFromRole(rperm, rrole)
+                    prm.unsetPermissionFromRole(rperm, rrole)
 
         if not testing:
             return self.index( REQUEST,
@@ -96,7 +96,7 @@
             if ir in roles:
                 prm.grantPermissionToRole(permission_id, ir)
             else:
-                prm.retractPermissionFromRole(permission_id, ir)
+                prm.unsetPermissionFromRole(permission_id, ir)
         if not testing:
             return self.index(REQUEST,
                               message="Settings changed at %s"
@@ -111,7 +111,7 @@
             if ip in permissions:
                 prm.grantPermissionToRole(ip, role_id)
             else:
-                prm.retractPermissionFromRole(ip, role_id)
+                prm.unsetPermissionFromRole(ip, role_id)
         if not testing:
             return self.index(REQUEST,
                               message="Settings changed at %s"
@@ -139,12 +139,14 @@
     def roles(self):
         prm = getAdapter(self._context, IRolePermissionManager)
         proles = prm.getRolesForPermission(self._permission.getId())
+        proles = [role for role,directive in proles if directive=='Allow']        
         return [((role.getId() in proles) and '1' or None)
                 for role in self._roles]
-
+        
     def rolesInfo(self):
         prm = getAdapter(self._context, IRolePermissionManager)
         proles = prm.getRolesForPermission(self._permission.getId())
+        proles = [role for role,directive in proles if directive=='Allow']
         return [{'id': role.getId(),
                  'title': role.getTitle(),
                  'checked': ((role.getId() in proles) and '1' or None)}
@@ -171,10 +173,12 @@
     def permissionsInfo(self):
         prm = getAdapter(self._context, IRolePermissionManager)
         rperms = prm.getPermissionsForRole(self._role.getId())
+        rperms = [permission
+                  for permission,directive in rperms
+                  if directive=='Allow']
         return [{'id': permission.getId(),
                  'title': permission.getTitle(),
                  'checked': ((permission.getId() in rperms) and '1' or None)}
                 for permission in self._permissions]        
-