[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/services/pluggableauth - __init__.py:1.9

Naveen P pnaveen at zeomega.com
Thu Dec 18 04:57:44 EST 2003


Update of /cvs-repository/Zope3/src/zope/app/interfaces/services/pluggableauth
In directory cvs.zope.org:/tmp/cvs-serv29648/interfaces/services/pluggableauth

Modified Files:
	__init__.py 
Log Message:
Applied the containment constraints on the PluggableAuthorisationService, PrincipalSource, Registration Manager and Adapter Registration.


=== Zope3/src/zope/app/interfaces/services/pluggableauth/__init__.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/interfaces/services/pluggableauth/__init__.py:1.8	Sun Sep 21 13:32:29 2003
+++ Zope3/src/zope/app/interfaces/services/pluggableauth/__init__.py	Thu Dec 18 04:57:13 2003
@@ -16,10 +16,12 @@
 $Id$
 """
 from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.interfaces.container import IContainer 
+from zope.app.interfaces.container import IContainer, IContained
+from zope.app.container.constraints import ItemTypePrecondition
+from zope.app.container.constraints import ContainerTypesConstraint
 from zope.app.interfaces.security import IAuthenticationService, IPrincipal
 from zope.interface import Interface
-from zope.schema import Text, TextLine, Password
+from zope.schema import Text, TextLine, Password, Field
 
 class IUserSchemafied(IPrincipal):
     """A User object with schema-defined attributes."""
@@ -55,25 +57,7 @@
     def validate(test_password):
         """Confirm whether 'password' is the password of the user."""
 
-class IPluggableAuthenticationService(IAuthenticationService):
-    """An AuthenticationService that can contain multiple pricipal sources.
-    """
-
-    def addPrincipalSource(id, principal_source):
-        """Add an IReadPrincipalSource to the end of our OrderedContainer.
-
-        If id is already present or invalid (according to site
-        policy), raise KeyError.
-
-        If principal_source does not implement IReadPrincipalSource,
-        raise TypeError
-        """
 
-    def removePrincipalSource(id):
-        """Remove a PrincipalSource.
-
-        If id is not present, raise KeyError.
-        """
 
 class IPrincipalSource(Interface):
     """A read-only source of IPrincipals.
@@ -105,6 +89,22 @@
         similar to (e.g. contain) the given name.
         """
 
+
+
+class IPluggableAuthenticationService(IAuthenticationService, IContainer):
+    """An AuthenticationService that can contain multiple pricipal sources.
+    """
+
+    def __setitem__(id, principal_source):
+        """Add to object"""
+    __setitem__.precondition = ItemTypePrecondition(IPrincipalSource)
+  
+    def removePrincipalSource(id):
+        """Remove a PrincipalSource.
+
+        If id is not present, raise KeyError.
+        """
+
 class ILoginPasswordPrincipalSource(IPrincipalSource):
     """ A principal source which can authenticate a user given a
     login and a password """
@@ -121,7 +121,9 @@
         to change his login when his email address changes without
         effecting his security profile on the site.  """
 
-
-class IContainerPrincipalSource(IPrincipalSource, IContainer):
+class IContainerPrincipalSource(IPrincipalSource, IContained):
     """This is a marker interface for specifying principal sources that are
     also containers. """
+
+    __parent__= Field(
+        constraint = ContainerTypesConstraint(IPluggableAuthenticationService))




More information about the Zope3-Checkins mailing list