[Zope3-checkins] CVS: Zope3/src/zope/app/security - meta.zcml:1.8 metaconfigure.py:1.7 metadirectives.py:1.3

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Mar 20 14:53:18 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/security
In directory cvs.zope.org:/tmp/cvs-serv17444/src/zope/app/security

Modified Files:
	meta.zcml metaconfigure.py metadirectives.py 
Log Message:


Implemented permission redefinition portion of ZCMLEnhancements.


=== Zope3/src/zope/app/security/meta.zcml 1.7 => 1.8 ===
--- Zope3/src/zope/app/security/meta.zcml:1.7	Mon Mar  8 07:06:41 2004
+++ Zope3/src/zope/app/security/meta.zcml	Sat Mar 20 14:52:48 2004
@@ -44,5 +44,11 @@
       namespace="http://namespaces.zope.org/zope"
       schema=".metadirectives.IRequire"
       handler=".metaconfigure.require" />
- 
+
+  <meta:directive
+      name="redefinePermission"
+      namespace="http://namespaces.zope.org/meta"
+      schema=".metadirectives.IRedefinePermission"
+      handler=".metaconfigure.redefinePermission" />
+   
 </configure>


=== Zope3/src/zope/app/security/metaconfigure.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/security/metaconfigure.py:1.6	Mon Mar  8 07:06:41 2004
+++ Zope3/src/zope/app/security/metaconfigure.py	Sat Mar 20 14:52:48 2004
@@ -110,3 +110,14 @@
         discriminator = 'unauthenticatedPrincipal',
         callable = principalRegistry.defineDefaultPrincipal,
         args = (id, title, description) )
+
+def redefinePermission(_context, from_, to):
+    _context = _context.context
+    
+    # check if context has any permission mappings yet
+    if not hasattr(_context, 'permission_mapping'):
+        _context.permission_mapping={}
+
+    _context.permission_mapping[from_] = to
+    
+


=== Zope3/src/zope/app/security/metadirectives.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/security/metadirectives.py:1.2	Mon Mar  8 07:06:41 2004
+++ Zope3/src/zope/app/security/metadirectives.py	Sat Mar 20 14:52:48 2004
@@ -19,6 +19,7 @@
 from zope.configuration.fields import GlobalObject, Tokens, PythonIdentifier
 from zope.configuration.fields import MessageID
 from zope.schema import InterfaceField, Id, TextLine
+from fields import Permission
 
 class ISecurityPolicyDirective(Interface):
     """Defines the security policy that will be used for Zope."""
@@ -69,7 +70,7 @@
     interfaces listed in the interface attribute.  
     """
     
-    permission = Id(
+    permission = Permission(
         title=u"Permission ID",
         description=u"The id of the permission to require.")
 
@@ -130,3 +131,17 @@
 
 class IDefineUnauthenticatedPrincipalDirective(IBasePrincipalDirective):
     """Define a new unauthenticated principal."""
+
+class IRedefinePermission(Interface):
+    """Define a permission to replace another permission."""
+
+    from_ = Permission(
+        title=u"from",
+        description=u"Original permission id to redefine.",
+        required=True)
+    
+    to = Permission(
+        title=u"to",
+        description=u"Substituted permission id.",
+        required=True)
+




More information about the Zope3-Checkins mailing list