[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - AttributePrincipalPermissionManager.py:1.1.2.4 AttributePrincipalRoleManager.py:1.1.2.4 AttributeRolePermissionManager.py:1.1.2.9 IAttributePrincipalPermissionManageable.py:NONE IAttributePrincipalRoleManageable.py:NONE IAttributeRolePermissionManageable.py:NONE
Casey Duncan
casey@zope.com
Thu, 28 Mar 2002 17:02:15 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv30227/App/Security
Modified Files:
Tag: Zope-3x-branch
AttributePrincipalPermissionManager.py
AttributePrincipalRoleManager.py
AttributeRolePermissionManager.py
Removed Files:
Tag: Zope-3x-branch
IAttributePrincipalPermissionManageable.py
IAttributePrincipalRoleManageable.py
IAttributeRolePermissionManageable.py
Log Message:
Refactored security managers to store data using mementos. Removed previous
storage marker interfaces.
=== Zope3/lib/python/Zope/App/Security/AttributePrincipalPermissionManager.py 1.1.2.3 => 1.1.2.4 ===
"""Mappings between principals and permissions, stored in an object locally."""
+from Zope.ComponentArchitecture import getAdapter
+from Zope.App.OFS.Memento.IMementoBag import IMementoBag
from Zope.App.Security.IPrincipalPermissionManager \
import IPrincipalPermissionManager
from Zope.App.Security.LocalSecurityMap import LocalSecurityMap
from Zope.App.Security.Settings import Allow, Deny, Unset
+memo_key = 'Zope.App.Security.AttributePrincipalPermissionManager'
+
class AttributePrincipalPermissionManager:
"""Mappings between principals and permissions."""
@@ -77,11 +81,11 @@
def _getPrincipalPermissions(self, create=0):
""" Get the principal permission map stored in the context, optionally
creating one if necessary """
+ memo = getAdapter(self._context, IMementoBag)
try:
- return self._context.__principal_permissions__
- except AttributeError:
+ return memo[memo_key]
+ except KeyError:
if create:
- pp = self._context.__principal_permissions__ = \
- LocalSecurityMap()
- return pp
+ rp = memo[memo_key] = LocalSecurityMap()
+ return rp
return None
=== Zope3/lib/python/Zope/App/Security/AttributePrincipalRoleManager.py 1.1.2.3 => 1.1.2.4 ===
"""Mappings between principals and roles, stored in an object locally."""
+from Zope.ComponentArchitecture import getAdapter
+from Zope.App.OFS.Memento.IMementoBag import IMementoBag
from Zope.App.Security.IPrincipalRoleManager \
import IPrincipalRoleManager
from Zope.App.Security.LocalSecurityMap import LocalSecurityMap
from Zope.App.Security.Settings import Assign, Remove, Unset
+memo_key = 'Zope.App.Security.AttributePrincipalRoleManager'
+
class AttributePrincipalRoleManager:
"""Mappings between principals and roles."""
@@ -77,11 +81,11 @@
def _getPrincipalRoles(self, create=0):
""" Get the principal role map stored in the context, optionally
creating one if necessary """
+ memo = getAdapter(self._context, IMementoBag)
try:
- return self._context.__principal_roles__
- except AttributeError:
+ return memo[memo_key]
+ except KeyError:
if create:
- pp = self._context.__principal_roles__ = \
- LocalSecurityMap()
- return pp
+ rp = memo[memo_key] = LocalSecurityMap()
+ return rp
return None
=== Zope3/lib/python/Zope/App/Security/AttributeRolePermissionManager.py 1.1.2.8 => 1.1.2.9 ===
"""
-from Zope.ComponentArchitecture import getService, getAdapter
+from Zope.ComponentArchitecture import getAdapter
from Zope.App.OFS.Memento.IMementoBag import IMementoBag
from Zope.App.Security.IRolePermissionManager import IRolePermissionManager
from Zope.App.Security.LocalSecurityMap import LocalSecurityMap
=== Removed File Zope3/lib/python/Zope/App/Security/IAttributePrincipalPermissionManageable.py ===
=== Removed File Zope3/lib/python/Zope/App/Security/IAttributePrincipalRoleManageable.py ===
=== Removed File Zope3/lib/python/Zope/App/Security/IAttributeRolePermissionManageable.py ===