[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - PrincipalPermissionMap.py:1.1.2.1
Barry Warsaw
barry@wooz.org
Thu, 13 Dec 2001 12:57:39 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv8268/lib/python/Zope/App/Security
Added Files:
Tag: Zope-3x-branch
PrincipalPermissionMap.py
Log Message:
A new map between principals and permissions, largely similar to
RolePermissionMap.
=== Added File Zope3/lib/python/Zope/App/Security/PrincipalPermissionMap.py ===
# PrincipalPermissionMap.py
#
# Copyright (c) 2001 Zope Coporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
"""Mappings between principals and permissions."""
from Zope.App.Security.SecurityMap import SecurityMap
class PrincipalPermissionMap(SecurityMap):
"""Mappings between principals and permissions."""
"""Bind the permission to the principal.
permission must be an IPermission
principal must be an IPrincipal
"""
grantPermissionToPrincipal = SecurityMap.addCell
"""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.
"""
getPrincipalsForPermission = SecurityMap.getColumnsForRow
"""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.
"""
getPermissionsForPrincipal = SecurityMap.getRowsForColumn
# Permissions are our rows, and principals are our columns
map = PrincipalPermissionMap()