[Zope3-checkins] SVN: Zope3/trunk/ Made PAS a local utility and provided an edit view to select plug-ins.

Daniel Nouri dpunktnpunkt at web.de
Sun Oct 10 09:52:56 EDT 2004


Log message for revision 27903:
  Made PAS a local utility and provided an edit view to select plug-ins.
  Removed vocabularies since it duplicated other code.
  


Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  A   Zope3/trunk/package-includes/pas-configure.zcml
  U   Zope3/trunk/src/zope/app/pas/configure.zcml
  U   Zope3/trunk/src/zope/app/pas/pas.py
  D   Zope3/trunk/src/zope/app/pas/vocabularies.py


-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2004-10-10 13:43:35 UTC (rev 27902)
+++ Zope3/trunk/doc/CHANGES.txt	2004-10-10 13:52:56 UTC (rev 27903)
@@ -142,7 +142,7 @@
     Much thanks to everyone who contributed to this release:
 
       Jim Fulton, Fred Drake, Philipp von Weitershausen, Stephan Richter,
-      Gustavo Niemeyer
+      Gustavo Niemeyer, Daniel Nouri
 
       Note: If you are not listed and contributed, please add yourself. This
       note will be deleted before the release.

Added: Zope3/trunk/package-includes/pas-configure.zcml
===================================================================
--- Zope3/trunk/package-includes/pas-configure.zcml	2004-10-10 13:43:35 UTC (rev 27902)
+++ Zope3/trunk/package-includes/pas-configure.zcml	2004-10-10 13:52:56 UTC (rev 27903)
@@ -0,0 +1 @@
+<include package="zope.app.pas" />
\ No newline at end of file


Property changes on: Zope3/trunk/package-includes/pas-configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/pas/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/pas/configure.zcml	2004-10-10 13:43:35 UTC (rev 27902)
+++ Zope3/trunk/src/zope/app/pas/configure.zcml	2004-10-10 13:52:56 UTC (rev 27903)
@@ -4,6 +4,73 @@
     i18n_domain="zope"
     >
 
+  <localService class=".LocalPAS">
+    <require
+        permission="zope.ManageServices"
+        interface="zope.app.site.interfaces.ISimpleService"
+        />
+    <require
+        permission="zope.ManageServices"
+        interface=".pas.IPAS"
+        set_schema=".pas.IPAS"
+        />
+  </localService>
+
+  <browser:addMenuItem
+       class=".pas.LocalPAS"
+       title="Pluggable Authentication Service"
+       description="New-style pluggable authentication service"
+       permission="zope.ManageServices"
+       />
+
+  <browser:editform
+      schema=".pas.IPAS"
+      label="Edit Pluggable Authentication Service"
+      name="edit.html"
+      menu="zmi_views" title="Edit"
+      permission="zope.ManageServices" />
+
+  <interface interface="zope.app.pas.interfaces.IExtractionPlugin" />
+  <interface interface="zope.app.pas.interfaces.IAuthenticationPlugin" />
+  <interface interface="zope.app.pas.interfaces.IChallengePlugin" />
+  <interface interface="zope.app.pas.interfaces.IPrincipalFactoryPlugin" />
+  <interface interface="zope.app.pas.interfaces.IPrincipalSearchPlugin" />
+
+  <vocabulary
+    name="ExtractionPlugins"
+    factory="zope.app.utility.vocabulary.UtilityVocabulary"
+    interface="zope.app.pas.interfaces.IExtractionPlugin" 
+    nameOnly="True"
+   />
+
+  <vocabulary
+    name="AuthenticationPlugins"
+    factory="zope.app.utility.vocabulary.UtilityVocabulary"
+    interface="zope.app.pas.interfaces.IAuthenticationPlugin" 
+    nameOnly="True"
+   />
+
+  <vocabulary
+    name="ChallengePlugins"
+    factory="zope.app.utility.vocabulary.UtilityVocabulary"
+    interface="zope.app.pas.interfaces.IChallengePlugin" 
+    nameOnly="True"
+   />
+
+  <vocabulary
+    name="PrincipalFactoryPlugins"
+    factory="zope.app.utility.vocabulary.UtilityVocabulary"
+    interface="zope.app.pas.interfaces.IPrincipalFactoryPlugin" 
+    nameOnly="True"
+   />
+
+  <vocabulary
+    name="PrincipalSearchPlugins"
+    factory="zope.app.utility.vocabulary.UtilityVocabulary"
+    interface="zope.app.pas.interfaces.IPrincipalSearchPlugin" 
+    nameOnly="True"
+   />
+
   <localUtility class=".httpplugin.HTTPBasicAuthExtractor">
 
     <implements

Modified: Zope3/trunk/src/zope/app/pas/pas.py
===================================================================
--- Zope3/trunk/src/zope/app/pas/pas.py	2004-10-10 13:43:35 UTC (rev 27902)
+++ Zope3/trunk/src/zope/app/pas/pas.py	2004-10-10 13:52:56 UTC (rev 27903)
@@ -23,13 +23,14 @@
 
 from zope.app import zapi
 
+from zope.app.security.interfaces import IAuthenticationService
 from zope.app.servicenames import Authentication
 from zope.app.component.localservice import queryNextService
 from zope.app.container.contained import Contained
 from zope.app.site.interfaces import ISimpleService
 from zope.app.location.interfaces import ILocation
 
-from zope.app.pas import vocabularies, interfaces
+from zope.app.pas import interfaces
 from zope.app.pas.interfaces import IExtractionPlugin
 from zope.app.pas.interfaces import IAuthenticationPlugin
 from zope.app.pas.interfaces import IChallengePlugin
@@ -41,44 +42,39 @@
     """Pluggable Authentication Service
     """
     
-    extractors = zope.schema.Tuple(
+    extractors = zope.schema.List(
         title=u"Credential Extractors",
-        value_type = zope.schema.Choice(
-            vocabulary = vocabularies.UtilityNames(IExtractionPlugin)),
-        default=(),
+        value_type = zope.schema.Choice(vocabulary='ExtractionPlugins'),
+        default=[],
         )
     
-    authenticators = zope.schema.Tuple(
+    authenticators = zope.schema.List(
         title=u"Authenticators",
-        value_type = zope.schema.Choice(
-            vocabulary = vocabularies.UtilityNames(IAuthenticationPlugin)),
-        default=(),
+        value_type = zope.schema.Choice(vocabulary='AuthenticationPlugins'),
+        default=[],
         )
     
-    challengers = zope.schema.Tuple(
+    challengers = zope.schema.List(
         title=u"Challengers",
-        value_type = zope.schema.Choice(
-            vocabulary = vocabularies.UtilityNames(IChallengePlugin)),
-        default=(),
+        value_type = zope.schema.Choice(vocabulary='ChallengePlugins'),
+        default=[],
         )
     
-    factories = zope.schema.Tuple(
+    factories = zope.schema.List(
         title=u"Principal Factories",
-        value_type = zope.schema.Choice(
-            vocabulary = vocabularies.UtilityNames(IPrincipalFactoryPlugin)),
-        default=(),
+        value_type = zope.schema.Choice(vocabulary='PrincipalFactoryPlugins'),
+        default=[],
         )
     
-    searchers = zope.schema.Tuple(
+    searchers = zope.schema.List(
         title=u"Search Plugins",
-        value_type = zope.schema.Choice(
-            vocabulary = vocabularies.UtilityNames(IPrincipalSearchPlugin)),
-        default=(),
+        value_type = zope.schema.Choice(vocabulary='PrincipalSearchPlugins'),
+        default=[],
         )
     
 class PAS:
 
-    zope.interface.implements(IPAS)
+    zope.interface.implements(IPAS, IAuthenticationService)
 
     authenticators = extractors = challengers = factories = search = ()
 

Deleted: Zope3/trunk/src/zope/app/pas/vocabularies.py
===================================================================
--- Zope3/trunk/src/zope/app/pas/vocabularies.py	2004-10-10 13:43:35 UTC (rev 27902)
+++ Zope3/trunk/src/zope/app/pas/vocabularies.py	2004-10-10 13:52:56 UTC (rev 27903)
@@ -1,64 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.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.
-#
-##############################################################################
-"""Simple utility name vocabulary to support the PAS
-
-XXX Need doc/test for this still.
-XXX For now this is effectively a placeholder.
-
-$Id$
-"""
-
-import zope.interface
-import zope.schema.interfaces
-from zope.app import zapi
-
-class NameTerm:
-
-    def __init__(self, value):
-        self.value = unicode(value)
-
-    def token(self):
-        # Return our value as a token.  This is required to be 7-bit
-        # printable ascii. We'll use base64
-        return self.value.encode('base64')[:-1]
-    token = property(token)
-
-    def title(self):
-        return self.value
-    title = property(title)
-
-class UtilityNames:
-
-    zope.interface.implements(zope.schema.interfaces.IVocabularyTokenized)
-
-    def __init__(self, interface):
-        self.interface = interface
-
-    def __contains__(value):
-        return zapi.queryUtility(self.interface, value) is not None
-
-    def getQuery():
-        pass
-
-    def getTerm(value):
-        return NameTerm(value)
-
-    def __iter__():
-        for name, ut in zapi.getUtilitiesFor(self.interface):
-            return NameTerm(name)
-
-    def __len__():
-        """Return the number of valid terms, or sys.maxint."""
-        return len(list(zapi.getUtilitiesFor(self.interface)))
-    



More information about the Zope3-Checkins mailing list