[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - IPrincipalRoleManager.py:1.1.2.3 PrincipalPermissionManager.py:1.1.2.6
Anthony Baxter
anthony@interlink.com.au
Fri, 8 Feb 2002 18:00:21 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv22192
Modified Files:
Tag: Zope-3x-branch
IPrincipalRoleManager.py PrincipalPermissionManager.py
Log Message:
Backing out today's snafu to make the unit tests pass. We'll finish it
up and commit it tomorrow. Apologies for the interruption to service.
=== Zope3/lib/python/Zope/App/Security/IPrincipalRoleManager.py 1.1.2.2 => 1.1.2.3 ===
principal must be an IPrincipal
"""
-
- def removeRoleFromPrincipal(role, principal):
- """ remove a role from the principal """
-
- def unsetRoleForPrincipal(role, principal):
- """ unset the role for the principal """
=== Zope3/lib/python/Zope/App/Security/PrincipalPermissionManager.py 1.1.2.5 => 1.1.2.6 ===
from Zope.App.Security.IPrincipalPermissionManager \
import IPrincipalPermissionManager
-from Zope.App.Security.LocalSecurityMap import LocalSecurityMap
-from Zope.App.Security.Settings import Allow, Deny, Unset
+from Zope.App.Security.SecurityMap import SecurityMap
-class PrincipalPermissionManager(LocalSecurityMap):
+class PrincipalPermissionManager(SecurityMap):
"""Mappings between principals and permissions."""
__implements__ = IPrincipalPermissionManager
+ """Bind the permission to the principal.
+
+ permission must be an IPermission
+ principal must be an IPrincipal
+ """
def grantPermissionToPrincipal( self, permission, principal ):
- ''' See the interface IPrincipalPermissionManager '''
- self.addCell( permission, principal, Allow )
+ self.addCell( permission, principal )
- def denyPermissionToPrincipal( self, permission, principal ):
- ''' See the interface IPrincipalPermissionManager '''
- self.addCell( permission, principal, Deny )
-
- def unsetPermissionForPrincipal( self, permission, principal ):
- ''' See the interface IPrincipalPermissionManager '''
- self.delCell( permission, principal )
+ """Return the list of principals for the given permission.
+ permission must be an IPermission. If no principals have been granted
+ this permission, then the empty list is returned.
+ """
def getPrincipalsForPermission( self, permission ):
- ''' See the interface IPrincipalPermissionManager '''
- return self.getRow( permission )
+ return self.getColumnsForRow( permission )
+
+ """Return the list of permissions for the given principal.
+ principal must be an IPrincipal. If no permissions have been granted
+ to this principal, then the empty list is returned.
+ """
def getPermissionsForPrincipal( self, principal ):
- ''' See the interface IPrincipalPermissionManager '''
- return self.getCol( principal )
+ return self.getRowsForColumn( principal )
- def getSetting( self, permission, principal ):
- ''' See the interface IPrincipalPermissionManager '''
- return self.getCell( permission, principal, default=Unset )
# Permissions are our rows, and principals are our columns
principalPermissionManager = PrincipalPermissionManager()