[Zope3-checkins] SVN: Zope3/branches/mgedmin-security/src/zope/security/ Updated zope.security.interfaces. Added a dummy implementation of

Marius Gedminas marius at pov.lt
Wed May 12 14:28:53 EDT 2004


Log message for revision 24597:
Updated zope.security.interfaces.  Added a dummy implementation of
ISecurityManagement.getSecurityPolicy.




-=-
Modified: Zope3/branches/mgedmin-security/src/zope/security/interfaces.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/security/interfaces.py	2004-05-12 18:01:15 UTC (rev 24596)
+++ Zope3/branches/mgedmin-security/src/zope/security/interfaces.py	2004-05-12 18:28:52 UTC (rev 24597)
@@ -17,7 +17,8 @@
 """
 from zope.interface import Interface, Attribute
 
-class ISecurityManagementSetup(Interface):
+
+class ISecurityManagementSetup(Interface):  # XXX: going away
     """Methods to manage the security manager.
 
     Infrastructure (including tests, etc.) calls these things to
@@ -39,12 +40,16 @@
     def noSecurityManager():
         """Clear any existing SecurityManager."""
 
+
 class ISecurityManagement(Interface):
     """Public security management API."""
 
-    def getSecurityManager():
+    def getSecurityManager():   # XXX: going away
         """Get a SecurityManager (create if needed)."""
 
+    def getSecurityPolicy():
+        """Get the system default security policy."""
+
     def setSecurityPolicy(aSecurityPolicy):
         """Set the system default security policy.
 
@@ -52,6 +57,22 @@
         should never, for example, be called during a web request.
         """
 
+
+class ISecurityChecking(Interface):
+    """Public security API."""
+
+    def checkPermission(permission, object, interaction=None):
+        """Return whether security policy allows permission on object.
+
+        Arguments:
+        permission -- A permission name
+        object -- The object being accessed according to the permission
+        interaction -- An interaction, which provides access to information
+            such as authenticated principals.  If it is None, the current
+            interaction is used.
+        """
+
+
 class ISecurityProxyFactory(Interface):
 
     def __call__(object, checker=None):
@@ -64,10 +85,11 @@
         returned.
         """
 
+
 # XXX This interface has too much Zope application dependence. This
 # needs to be refactored somehow.
 
-class ISecurityManager(Interface):
+class ISecurityManager(Interface):  # XXX: going away
     """
         A security manager provides methods for checking access and managing
         executable context and policies.
@@ -178,7 +200,7 @@
         """
 
 
-class ISecurityContext(Interface):
+class ISecurityContext(Interface):  # XXX: going away
     """Capture transient request-specific security information."""
 
     Attribute('stack',
@@ -190,3 +212,43 @@
     Attribute('user',
               'The AUTHENTICATED_USER for the request.'
               )
+
+
+class IInteraction(Interface):
+    """A representation of an interaction between some actors and the system.
+    """
+
+    participations = Attribute("""An iterable of participations.""")
+
+    def add(participation):
+        """Add a participation."""
+
+    def remove(participation):
+        """Remove a participation."""
+
+
+class IParticipation(Interface):
+
+    interaction = Attribute("The interaction")
+    principal = Attribute("The authenticated principal")
+
+
+class IInteractionManagement(Interface):
+    """Interaction management API."""
+
+    def newInteraction(participation=None):
+        """Start a new interaction.
+
+        If participation is not None, it is added to the new interaction.
+        """
+
+    def getInteraction():
+        """Return the current interaction.
+
+        Returns None if called outside newInteraction/endInteraction pair.
+        XXX should it raise an exception instead?
+        """
+
+    def endInteraction():
+        """End the current interaction."""
+

Modified: Zope3/branches/mgedmin-security/src/zope/security/management.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/security/management.py	2004-05-12 18:01:15 UTC (rev 24596)
+++ Zope3/branches/mgedmin-security/src/zope/security/management.py	2004-05-12 18:28:52 UTC (rev 24597)
@@ -81,6 +81,10 @@
 
     return manager
 
+def getSecurityPolicy():
+    """Get the system default security policy."""
+    raise NotImplementedError # XXX
+
 def setSecurityPolicy(aSecurityPolicy):
     """Set the system default security policy, and return the previous
     value.




More information about the Zope3-Checkins mailing list