[Checkins] SVN: Zope3/branches/jim-adapter/src/zope/app/authentication/ Changed the way plugins are handled. Now plugins are always

Jim Fulton jim at zope.com
Tue Apr 18 19:55:48 EDT 2006


Log message for revision 67095:
  Changed the way plugins are handled.  Now plugins are always 
  handled as "in contents". We don't register them and we don't need to 
  provide custom addRegistration views for them.
  
  Removed the custom registration for the authentication utility and
  replaced it with a custom addRegistration view.  The goal being to 
  avoid making people pick a name or interface.
  

Changed:
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/authentication.py
  A   Zope3/branches/jim-adapter/src/zope/app/authentication/browser/adding.py
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/browser/configure.zcml
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/browser/groupfolder.txt
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/browser/pau_prefix_and_searching.txt
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/browser/principalfolder.txt
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/browser/register.py
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/browser/special-groups.txt
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/vocabulary.py
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/vocabulary.txt

-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/authentication.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/authentication.py	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/authentication.py	2006-04-18 23:55:46 UTC (rev 67095)
@@ -22,12 +22,12 @@
 
 from zope.app.security.interfaces import IAuthentication, PrincipalLookupError
 from zope.app.component import queryNextUtility
-from zope.app.component.site import SiteManagementFolder
+import zope.app.container.btree
+
 from zope.app.authentication import interfaces
 
+class PluggableAuthentication(zope.app.container.btree.BTreeContainer):
 
-class PluggableAuthentication(SiteManagementFolder):
-
     zope.interface.implements(
         IAuthentication,
         interfaces.IPluggableAuthentication,

Added: Zope3/branches/jim-adapter/src/zope/app/authentication/browser/adding.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/browser/adding.py	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/browser/adding.py	2006-04-18 23:55:46 UTC (rev 67095)
@@ -0,0 +1,26 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Adding that redirects to plugins.html.
+
+$Id$
+"""
+
+from zope.app import zapi
+
+import zope.app.container.browser.adding
+
+class Adding(zope.app.container.browser.adding.Adding):
+    
+    def nextURL(self):
+        return zapi.absoluteURL(self.context, self.request) + '/@@plugins.html'


Property changes on: Zope3/branches/jim-adapter/src/zope/app/authentication/browser/adding.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/browser/configure.zcml
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/browser/configure.zcml	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/browser/configure.zcml	2006-04-18 23:55:46 UTC (rev 67095)
@@ -29,6 +29,13 @@
        permission="zope.ManageServices"
        />
 
+  <page
+      for="..interfaces.IPluggableAuthentication"
+      name="addRegistration.html"
+      permission="zope.ManageSite"
+      class=".register.AddAuthenticationRegistration" 
+      />
+
   <editform
       schema="..interfaces.IPluggableAuthentication"
       label="Edit Pluggable Authentication Utility"
@@ -46,6 +53,17 @@
       attribute="contents"
       />
 
+  <view
+      name="+"
+      menu="zmi_actions" title="Add"
+      for="..interfaces.IPluggableAuthentication"
+      permission="zope.ManageSite"
+      class=".adding.Adding"
+      >
+    <page name="index.html"  attribute="index"  />
+    <page name="action.html" attribute="action" />
+  </view>
+
   <menuItem
       menu="zmi_views"
       for="..interfaces.IPluggableAuthentication"
@@ -53,42 +71,6 @@
       action=""
       filter="python:False" />
 
-  <addform
-      label="New Pluggable Authentication Utility Registration"
-      for="..interfaces.IPluggableAuthentication"
-      name="addRegistration.html"
-      schema="zope.app.component.interfaces.IUtilityRegistration"
-      class="zope.app.component.browser.registration.AddComponentRegistration"
-      permission="zope.ManageSite"
-      content_factory=".register.pluggableAuthenticationRegistration"
-      arguments="component"
-      fields="component status permission"
-      />
-
-  <addform
-      label="New Credentials Plugin Registration"
-      for="..interfaces.ICredentialsPlugin"
-      name="addRegistration.html"
-      schema="zope.app.component.interfaces.IUtilityRegistration"
-      class="zope.app.component.browser.registration.AddComponentRegistration"
-      permission="zope.ManageSite"
-      content_factory=".register.credentialsPluginRegistration"
-      arguments="name component"
-      fields="name component status permission"
-      />
-
-  <addform
-      label="New Authenticator Plugin Registration"
-      for="..interfaces.IAuthenticatorPlugin"
-      name="addRegistration.html"
-      schema="zope.app.component.interfaces.IUtilityRegistration"
-      class="zope.app.component.browser.registration.AddComponentRegistration"
-      permission="zope.ManageSite"
-      content_factory=".register.authenticatorPluginRegistration"
-      arguments="name component"
-      fields="name component status permission"
-      />
-
   <zope:adapter
       for="..interfaces.IQuerySchemaSearch
            zope.publisher.interfaces.browser.IBrowserRequest"
@@ -96,14 +78,4 @@
       factory=".schemasearch.QuerySchemaSearchView"
       />
 
-  <tool
-      interface="..interfaces.ICredentialsPlugin"
-      title="Credentials Plugin"
-      />
-
-  <tool
-      interface="..interfaces.IAuthenticatorPlugin"
-      title="Authenticator Plugin"
-      />
-
 </zope:configure>

Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/browser/groupfolder.txt
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/browser/groupfolder.txt	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/browser/groupfolder.txt	2006-04-18 23:55:46 UTC (rev 67095)
@@ -98,46 +98,6 @@
   HTTP/1.1 303 See Other
   ...
 
-
-Register Principal Folder as `users`.
-
-  >>> print http(r"""
-  ... POST /++etc++site/default/PAU/users/addRegistration.html HTTP/1.1
-  ... Authorization: Basic bWdyOm1ncnB3
-  ... Content-Length: 806
-  ... Content-Type: multipart/form-data; boundary=---------------------------3658059809094229671187159254
-  ... Cookie: zope3_cs_6a553b3=-j7C3CdeW9sUK8BP5x97u2d9o242xMJDzJd8HCQ5AAi9xeFcGTFkAs
-  ... Referer: http://localhost:8081/++etc++site/default/PAU/users/addRegistration.html
-  ...
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.name"
-  ...
-  ... users
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.status"
-  ...
-  ... Active
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.status-empty-marker"
-  ...
-  ... 1
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.permission"
-  ...
-  ...
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.permission-empty-marker"
-  ...
-  ... 1
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
-  ...
-  ... Add
-  ... -----------------------------3658059809094229671187159254--
-  ... """)
-  HTTP/1.1 303 See Other
-  ...
-
 Next we will add some users.
 
   >>> print http(r"""

Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/browser/pau_prefix_and_searching.txt
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/browser/pau_prefix_and_searching.txt	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/browser/pau_prefix_and_searching.txt	2006-04-18 23:55:46 UTC (rev 67095)
@@ -86,41 +86,6 @@
   HTTP/1.1 303 See Other
   ...
 
-  >>> print http(r"""
-  ... POST /++etc++site/default/PAU1/Users/addRegistration.html HTTP/1.1
-  ... Authorization: Basic bWdyOm1ncnB3
-  ... Content-Length: 701
-  ... Content-Type: multipart/form-data; boundary=---------------------------1293260033248
-  ...
-  ... -----------------------------1293260033248
-  ... Content-Disposition: form-data; name="field.name"
-  ...
-  ... Users
-  ... -----------------------------1293260033248
-  ... Content-Disposition: form-data; name="field.status"
-  ...
-  ... Active
-  ... -----------------------------1293260033248
-  ... Content-Disposition: form-data; name="field.status-empty-marker"
-  ...
-  ... 1
-  ... -----------------------------1293260033248
-  ... Content-Disposition: form-data; name="field.permission"
-  ...
-  ...
-  ... -----------------------------1293260033248
-  ... Content-Disposition: form-data; name="field.permission-empty-marker"
-  ...
-  ... 1
-  ... -----------------------------1293260033248
-  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
-  ...
-  ... Add
-  ... -----------------------------1293260033248--
-  ... """)
-  HTTP/1.1 303 See Other
-  ...
-
 and add a principal that we'll later search for:
 
   >>> print http(r"""

Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/browser/principalfolder.txt
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/browser/principalfolder.txt	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/browser/principalfolder.txt	2006-04-18 23:55:46 UTC (rev 67095)
@@ -109,46 +109,6 @@
 name ths plugin `users`.  This is the name we'll use when we configure
 the pluggable authentiaction service.
 
-
-Register Principal Folder as `users`.
-
-  >>> print http(r"""
-  ... POST /++etc++site/default/PAU/users/addRegistration.html HTTP/1.1
-  ... Authorization: Basic bWdyOm1ncnB3
-  ... Content-Length: 806
-  ... Content-Type: multipart/form-data; boundary=---------------------------3658059809094229671187159254
-  ... Cookie: zope3_cs_6a553b3=-j7C3CdeW9sUK8BP5x97u2d9o242xMJDzJd8HCQ5AAi9xeFcGTFkAs
-  ... Referer: http://localhost:8081/++etc++site/default/PAU/users/addRegistration.html
-  ... 
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.name"
-  ... 
-  ... users
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.status"
-  ... 
-  ... Active
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.status-empty-marker"
-  ... 
-  ... 1
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.permission"
-  ... 
-  ... 
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.permission-empty-marker"
-  ... 
-  ... 1
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
-  ... 
-  ... Add
-  ... -----------------------------3658059809094229671187159254--
-  ... """)
-  HTTP/1.1 303 See Other
-  ...  
-
 Next we'll view the contents page of the principal folder:
 
   >>> print http(r"""

Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/browser/register.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/browser/register.py	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/browser/register.py	2006-04-18 23:55:46 UTC (rev 67095)
@@ -1,14 +1,30 @@
-from zope.app.component.site import UtilityRegistration
-from zope.app.security.interfaces import IAuthentication
-from zope.app.authentication.interfaces import ICredentialsPlugin
-from zope.app.authentication.interfaces import IAuthenticatorPlugin
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Improved registration UI for registering pluggable autentication utilities
 
-def pluggableAuthenticationRegistration(view, component):
-    return UtilityRegistration(u'', IAuthentication, component)
+$Id$
+"""
 
-def credentialsPluginRegistration(view, name, component):
-    return UtilityRegistration(name, ICredentialsPlugin, component)
+from zope.app.i18n import ZopeMessageFactory as _
+import zope.app.component.browser.registration
+import zope.app.security.interfaces
 
-def authenticatorPluginRegistration(view, name, component):
-    return UtilityRegistration(name, IAuthenticatorPlugin, component)
+import zope.app.authentication.interfaces
 
+class AddAuthenticationRegistration(
+    zope.app.component.browser.registration.AddUtilityRegistration,
+    ):
+    label = _("Register a pluggable authentication utility")
+    name = ''
+    provided = zope.app.security.interfaces.IAuthentication

Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/browser/special-groups.txt
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/browser/special-groups.txt	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/browser/special-groups.txt	2006-04-18 23:55:46 UTC (rev 67095)
@@ -90,46 +90,6 @@
   HTTP/1.1 303 See Other
   ...
 
-
-Register Principal Folder.
-
-  >>> print http(r"""
-  ... POST /++etc++site/default/PAU/users/addRegistration.html HTTP/1.1
-  ... Authorization: Basic bWdyOm1ncnB3
-  ... Content-Length: 806
-  ... Content-Type: multipart/form-data; boundary=---------------------------3658059809094229671187159254
-  ... Cookie: zope3_cs_6a553b3=-j7C3CdeW9sUK8BP5x97u2d9o242xMJDzJd8HCQ5AAi9xeFcGTFkAs
-  ... Referer: http://localhost:8081/++etc++site/default/PAU/users/addRegistration.html
-  ... 
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.name"
-  ... 
-  ... users
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.status"
-  ... 
-  ... Active
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.status-empty-marker"
-  ... 
-  ... 1
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.permission"
-  ... 
-  ... 
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="field.permission-empty-marker"
-  ... 
-  ... 1
-  ... -----------------------------3658059809094229671187159254
-  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
-  ... 
-  ... Add
-  ... -----------------------------3658059809094229671187159254--
-  ... """)
-  HTTP/1.1 303 See Other
-  ...
-
 Add a principal to it:
 
   >>> print http(r"""

Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/vocabulary.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/vocabulary.py	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/vocabulary.py	2006-04-18 23:55:46 UTC (rev 67095)
@@ -25,7 +25,6 @@
 from zope.schema import vocabulary
 from zope.schema.interfaces import IVocabularyFactory
 
-from zope.app.component.interfaces import ILocalUtility
 from zope.app.i18n import ZopeMessageFactory as _
 
 from zope.app.authentication import interfaces
@@ -48,11 +47,10 @@
     which is expected to be a pluggable authentication utility, hereafter
     referred to as a PAU).
 
-    These plugins may be objects contained within the PAU that do not provide
-    zope.app.component.interfaces.ILocalUtility ("contained plugins"), or may
-    be utilities registered for the specified interface, found in the context
-    of the PAU ("utility plugins").  Contained plugins mask utility plugins of
-    the same name.
+    These plugins may be objects contained within the PAU ("contained
+    plugins"), or may be utilities registered for the specified
+    interface, found in the context of the PAU ("utility plugins").
+    Contained plugins mask utility plugins of the same name.
 
     The vocabulary also includes the current values of the PAU even if they do
     not correspond to a contained or utility plugin.
@@ -61,7 +59,7 @@
     isPAU = interfaces.IPluggableAuthentication.providedBy(context)
     if isPAU:
         for k, v in context.items():
-            if interface.providedBy(v) and not ILocalUtility.providedBy(v):
+            if interface.providedBy(v):
                 dc = zope.dublincore.interfaces.IDCDescriptiveProperties(
                     v, None)
                 if dc is not None and dc.title:

Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/vocabulary.txt
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/vocabulary.txt	2006-04-18 23:55:40 UTC (rev 67094)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/vocabulary.txt	2006-04-18 23:55:46 UTC (rev 67095)
@@ -132,8 +132,8 @@
     >>> pprint.pprint([i18n.translate(term.title) for term in vocab])
     [u'Plugin 0 (a utility)',
      u'Special Title (in contents)',
-     u'Plugin 2 (a utility)',
-     u'Plugin 3 (a utility)',
+     u'Plugin 2 (in contents)',
+     u'Plugin 3 (in contents)',
      u'Plugin 4 (in contents)',
      u'Plugin X (not found; deselecting will remove)']
 
@@ -200,7 +200,7 @@
     >>> pprint.pprint([i18n.translate(term.title) for term in vocab])
     [u'Plugin 0 (a utility)',
      u'Special Title (in contents)',
-     u'Plugin 2 (a utility)',
-     u'Plugin 3 (a utility)',
+     u'Plugin 2 (in contents)',
+     u'Plugin 3 (in contents)',
      u'Plugin 4 (in contents)',
      u'Plugin X (not found; deselecting will remove)']



More information about the Checkins mailing list