[Checkins] SVN: zope.app.security/tags/3.6.1/ Tag 3.6.1.

Dan Korostelev nadako at gmail.com
Mon Mar 9 15:03:28 EDT 2009


Log message for revision 97716:
  Tag 3.6.1.

Changed:
  A   zope.app.security/tags/3.6.1/
  D   zope.app.security/tags/3.6.1/CHANGES.txt
  A   zope.app.security/tags/3.6.1/CHANGES.txt
  D   zope.app.security/tags/3.6.1/setup.py
  A   zope.app.security/tags/3.6.1/setup.py
  D   zope.app.security/tags/3.6.1/src/zope/app/security/basicauthadapter.py
  A   zope.app.security/tags/3.6.1/src/zope/app/security/basicauthadapter.py
  D   zope.app.security/tags/3.6.1/src/zope/app/security/browser/principalterms.py
  A   zope.app.security/tags/3.6.1/src/zope/app/security/browser/principalterms.py
  D   zope.app.security/tags/3.6.1/src/zope/app/security/ftpauth.py
  A   zope.app.security/tags/3.6.1/src/zope/app/security/ftpauth.py
  D   zope.app.security/tags/3.6.1/src/zope/app/security/loginpassword.py
  A   zope.app.security/tags/3.6.1/src/zope/app/security/loginpassword.py
  D   zope.app.security/tags/3.6.1/src/zope/app/security/permission.py
  A   zope.app.security/tags/3.6.1/src/zope/app/security/permission.py
  D   zope.app.security/tags/3.6.1/src/zope/app/security/principalregistry.py
  A   zope.app.security/tags/3.6.1/src/zope/app/security/principalregistry.py
  D   zope.app.security/tags/3.6.1/src/zope/app/security/vocabulary.py
  A   zope.app.security/tags/3.6.1/src/zope/app/security/vocabulary.py

-=-
Deleted: zope.app.security/tags/3.6.1/CHANGES.txt
===================================================================
--- zope.app.security/trunk/CHANGES.txt	2009-03-09 18:30:47 UTC (rev 97713)
+++ zope.app.security/tags/3.6.1/CHANGES.txt	2009-03-09 19:03:27 UTC (rev 97716)
@@ -1,74 +0,0 @@
-=======
-CHANGES
-=======
-
-3.6.1 (unreleased)
-------------------
-
-- Depend on new ``zope.password`` package instead of ``zope.app.authentication``
-  to get password managers for the authentication utility, thus remove
-  dependency on ``zope.app.authentication``.
-
-- Use template for AuthUtilitySearchView instead of ugly HTML
-  constructing in the python code.
-
-- Bug: The `sha` and `md5` modules has been deprecated in Python 2.6.
-  Whenever the ZCML of this package was included when using Python 2.6,
-  a deprecation warning had been raised stating that `md5` and `sha` have
-  been deprecated. Provided a simple condition to check whether Python 2.6
-  or later is installed by checking for the presense of `json` module
-  thas was added only in Python 2.6 and thus optionally load the security
-  declaration for `md5` and `sha`.
-
-- Remove deprecated code, thus removing explicit dependency on
-  zope.deprecation and zope.deferredimport.
-
-3.6.0 (2009-01-31)
-------------------
-
-- Changed mailing list address to zope-dev at zope.org, because
-  zope3-dev is retired now. Changed "cheeseshop" to "pypi" in
-  the package homepage.
-
-- Moved the `protectclass` module to `zope.security` leaving only a
-  compatibility module here that imports from the new location.
-
-- Moved the <module> directive implementation to `zope.security`.
-
-- Use `zope.container` instead of `zope.app.container`;.
-
-3.5.3 (2008-12-11)
-------------------
-
-- use zope.browser.interfaces.ITerms instead of
-  `zope.app.form.browser.interfaces`.
-
-3.5.2 (2008-07-31)
-------------------
-
-- Bug: It turned out that checking for regex was not much better of an
-  idea, since it causes deprecation warnings in Python 2.4. Thus let's
-  look for a library that was added in Python 2.5.
-
-3.5.1 (2008-06-24)
-------------------
-
-- Bug: The `gopherlib` module has been deprecated in Python 2.5. Whenever the
-  ZCML of this package was included when using Python 2.5, a deprecation
-  warning had been raised stating that `gopherlib` has been
-  deprecated. Provided a simple condition to check whether Python 2.5 or later
-  is installed by checking for the deleted `regex` module and thus optionally
-  load the security declaration for `gopherlib`.
-
-3.5.0 (2008-02-05)
-------------------
-
-- Feature:
-  `zope.app.security.principalregistry.PrincipalRegistry.getPrincipal` returns
-  `zope.security.management.system_user` when its id is used for the search
-  key.
-
-3.4.0 (2007-10-27)
-------------------
-
-- Initial release independent of the main Zope tree.

Copied: zope.app.security/tags/3.6.1/CHANGES.txt (from rev 97714, zope.app.security/trunk/CHANGES.txt)
===================================================================
--- zope.app.security/tags/3.6.1/CHANGES.txt	                        (rev 0)
+++ zope.app.security/tags/3.6.1/CHANGES.txt	2009-03-09 19:03:27 UTC (rev 97716)
@@ -0,0 +1,77 @@
+=======
+CHANGES
+=======
+
+3.6.1 (2009-03-09)
+------------------
+
+- Depend on new ``zope.password`` package instead of ``zope.app.authentication``
+  to get password managers for the authentication utility, thus remove
+  dependency on ``zope.app.authentication``.
+
+- Use template for AuthUtilitySearchView instead of ugly HTML
+  constructing in the python code.
+
+- Bug: The `sha` and `md5` modules has been deprecated in Python 2.6.
+  Whenever the ZCML of this package was included when using Python 2.6,
+  a deprecation warning had been raised stating that `md5` and `sha` have
+  been deprecated. Provided a simple condition to check whether Python 2.6
+  or later is installed by checking for the presense of `json` module
+  thas was added only in Python 2.6 and thus optionally load the security
+  declaration for `md5` and `sha`.
+
+- Remove deprecated code, thus removing explicit dependency on
+  zope.deprecation and zope.deferredimport.
+
+- Cleanup code a bit, replace old __used_for__ statements by ``adapts``
+  calls.
+
+3.6.0 (2009-01-31)
+------------------
+
+- Changed mailing list address to zope-dev at zope.org, because
+  zope3-dev is retired now. Changed "cheeseshop" to "pypi" in
+  the package homepage.
+
+- Moved the `protectclass` module to `zope.security` leaving only a
+  compatibility module here that imports from the new location.
+
+- Moved the <module> directive implementation to `zope.security`.
+
+- Use `zope.container` instead of `zope.app.container`;.
+
+3.5.3 (2008-12-11)
+------------------
+
+- use zope.browser.interfaces.ITerms instead of
+  `zope.app.form.browser.interfaces`.
+
+3.5.2 (2008-07-31)
+------------------
+
+- Bug: It turned out that checking for regex was not much better of an
+  idea, since it causes deprecation warnings in Python 2.4. Thus let's
+  look for a library that was added in Python 2.5.
+
+3.5.1 (2008-06-24)
+------------------
+
+- Bug: The `gopherlib` module has been deprecated in Python 2.5. Whenever the
+  ZCML of this package was included when using Python 2.5, a deprecation
+  warning had been raised stating that `gopherlib` has been
+  deprecated. Provided a simple condition to check whether Python 2.5 or later
+  is installed by checking for the deleted `regex` module and thus optionally
+  load the security declaration for `gopherlib`.
+
+3.5.0 (2008-02-05)
+------------------
+
+- Feature:
+  `zope.app.security.principalregistry.PrincipalRegistry.getPrincipal` returns
+  `zope.security.management.system_user` when its id is used for the search
+  key.
+
+3.4.0 (2007-10-27)
+------------------
+
+- Initial release independent of the main Zope tree.

Deleted: zope.app.security/tags/3.6.1/setup.py
===================================================================
--- zope.app.security/trunk/setup.py	2009-03-09 18:30:47 UTC (rev 97713)
+++ zope.app.security/tags/3.6.1/setup.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -1,87 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 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.
-#
-##############################################################################
-"""Setup for zope.app.security package
-
-$Id$
-"""
-import os
-from setuptools import setup, find_packages
-
-def read(*rnames):
-    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-
-setup(name='zope.app.security',
-      version = '3.6.1dev',
-      author='Zope Corporation and Contributors',
-      author_email='zope-dev at zope.org',
-      description='Security Components for Zope 3 Applications',
-      long_description=(
-          read('README.txt')
-          + '\n\n' +
-          'Detailed Documentation\n' +
-          '======================\n'
-          + '\n\n' +
-          read('src', 'zope', 'app', 'security', 'globalprincipals.txt')
-          + '\n\n' +
-          read('src', 'zope', 'app', 'security', 'logout.txt')
-          + '\n\n' +
-          read('src', 'zope', 'app', 'security', 'browser',
-               'authutilitysearchview.txt')
-          + '\n\n' +
-          read('src', 'zope', 'app', 'security', 'browser', 'loginlogout.txt')
-          + '\n\n' +
-          read('src', 'zope', 'app', 'security', 'browser',
-               'principalterms.txt')
-          + '\n\n' +
-          read('CHANGES.txt')
-          ),
-      keywords = "zope3 security authentication principal ftp http",
-      classifiers = [
-          'Development Status :: 5 - Production/Stable',
-          'Environment :: Web Environment',
-          'Intended Audience :: Developers',
-          'License :: OSI Approved :: Zope Public License',
-          'Programming Language :: Python',
-          'Natural Language :: English',
-          'Operating System :: OS Independent',
-          'Topic :: Internet :: WWW/HTTP',
-          'Framework :: Zope3'],
-      url='http://pypi.python.org/pypi/zope.app.security',
-      license='ZPL 2.1',
-      packages=find_packages('src'),
-      package_dir = {'': 'src'},
-      namespace_packages=['zope', 'zope.app'],
-      extras_require=dict(test=['zope.app.testing']),
-      install_requires=['setuptools',
-                        'zope.browser',
-                        'zope.app.component',
-                        'zope.app.form',
-                        'zope.app.pagetemplate',
-                        'zope.app.publisher',
-                        'zope.component',
-                        'zope.configuration',
-                        'zope.container',
-                        'zope.i18n',
-                        'zope.i18nmessageid',
-                        'zope.interface',
-                        'zope.location',
-                        'zope.password',
-                        'zope.publisher',
-                        'zope.schema',
-                        'zope.security',
-                        'ZODB3',
-                        ],
-      include_package_data = True,
-      zip_safe = False,
-      )

Copied: zope.app.security/tags/3.6.1/setup.py (from rev 97714, zope.app.security/trunk/setup.py)
===================================================================
--- zope.app.security/tags/3.6.1/setup.py	                        (rev 0)
+++ zope.app.security/tags/3.6.1/setup.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -0,0 +1,88 @@
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""Setup for zope.app.security package
+
+$Id$
+"""
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+setup(name='zope.app.security',
+      version = '3.6.1',
+      author='Zope Corporation and Contributors',
+      author_email='zope-dev at zope.org',
+      description='Security Components for Zope 3 Applications',
+      long_description=(
+          read('README.txt')
+          + '\n\n' +
+          'Detailed Documentation\n' +
+          '======================\n'
+          + '\n\n' +
+          read('src', 'zope', 'app', 'security', 'globalprincipals.txt')
+          + '\n\n' +
+          read('src', 'zope', 'app', 'security', 'logout.txt')
+          + '\n\n' +
+          read('src', 'zope', 'app', 'security', 'browser',
+               'authutilitysearchview.txt')
+          + '\n\n' +
+          read('src', 'zope', 'app', 'security', 'browser', 'loginlogout.txt')
+          + '\n\n' +
+          read('src', 'zope', 'app', 'security', 'browser',
+               'principalterms.txt')
+          + '\n\n' +
+          read('CHANGES.txt')
+          ),
+      keywords = "zope3 security authentication principal ftp http",
+      classifiers = [
+          'Development Status :: 5 - Production/Stable',
+          'Environment :: Web Environment',
+          'Intended Audience :: Developers',
+          'License :: OSI Approved :: Zope Public License',
+          'Programming Language :: Python',
+          'Natural Language :: English',
+          'Operating System :: OS Independent',
+          'Topic :: Internet :: WWW/HTTP',
+          'Framework :: Zope3'],
+      url='http://pypi.python.org/pypi/zope.app.security',
+      license='ZPL 2.1',
+      packages=find_packages('src'),
+      package_dir = {'': 'src'},
+      namespace_packages=['zope', 'zope.app'],
+      extras_require=dict(test=['zope.app.testing']),
+      install_requires=['setuptools',
+                        'zope.browser',
+                        'zope.app.component',
+                        'zope.app.form',
+                        'zope.app.pagetemplate',
+                        'zope.app.publisher',
+                        'zope.component',
+                        'zope.configuration',
+                        'zope.container',
+                        'zope.i18n',
+                        'zope.i18nmessageid',
+                        'zope.interface',
+                        'zope.location',
+                        'zope.password',
+                        'zope.publisher',
+                        'zope.schema',
+                        'zope.security',
+                        'zope.site',
+                        'ZODB3',
+                        ],
+      include_package_data = True,
+      zip_safe = False,
+      )

Deleted: zope.app.security/tags/3.6.1/src/zope/app/security/basicauthadapter.py
===================================================================
--- zope.app.security/trunk/src/zope/app/security/basicauthadapter.py	2009-03-09 18:30:47 UTC (rev 97713)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/basicauthadapter.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -1,40 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 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.
-#
-##############################################################################
-"""HTTP Basic Authentication adapter
-
-$Id$
-"""
-from zope.publisher.interfaces.http import IHTTPCredentials
-from loginpassword import LoginPassword
-
-
-class BasicAuthAdapter(LoginPassword):
-    """Adapter for handling HTTP Basic Auth."""
-
-    __used_for__ = IHTTPCredentials
-
-    __request = None
-
-    def __init__(self, request):
-        self.__request = request
-        # TODO base64 decoding should be done here, not in request
-        lpw = request._authUserPW()
-        if lpw is None:
-            login, password = None, None
-        else:
-            login, password = lpw
-        LoginPassword.__init__(self, login, password)
-
-    def needLogin(self, realm):
-        self.__request.unauthorized('basic realm="%s"'% realm)

Copied: zope.app.security/tags/3.6.1/src/zope/app/security/basicauthadapter.py (from rev 97714, zope.app.security/trunk/src/zope/app/security/basicauthadapter.py)
===================================================================
--- zope.app.security/tags/3.6.1/src/zope/app/security/basicauthadapter.py	                        (rev 0)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/basicauthadapter.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -0,0 +1,39 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 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.
+#
+##############################################################################
+"""HTTP Basic Authentication adapter
+
+$Id$
+"""
+from zope.component import adapts
+from zope.publisher.interfaces.http import IHTTPCredentials
+from zope.app.security.loginpassword import LoginPassword
+
+
+class BasicAuthAdapter(LoginPassword):
+    """Adapter for handling HTTP Basic Auth."""
+
+    adapts(IHTTPCredentials)
+
+    def __init__(self, request):
+        self.__request = request
+        # TODO base64 decoding should be done here, not in request
+        lpw = request._authUserPW()
+        if lpw is None:
+            login, password = None, None
+        else:
+            login, password = lpw
+        super(BasicAuthAdapter, self).__init__(login, password)
+
+    def needLogin(self, realm):
+        self.__request.unauthorized('basic realm="%s"' % realm)

Deleted: zope.app.security/tags/3.6.1/src/zope/app/security/browser/principalterms.py
===================================================================
--- zope.app.security/trunk/src/zope/app/security/browser/principalterms.py	2009-03-09 18:30:47 UTC (rev 97713)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/browser/principalterms.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -1,55 +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.
-#
-##############################################################################
-"""Terms view for Principal Source
-
-$Id$
-"""
-__docformat__ = "reStructuredText"
-
-from zope.component import getUtility
-from zope.interface import implements
-from zope.browser.interfaces import ITerms
-from zope.publisher.interfaces.browser import IBrowserRequest
-
-from zope.app.security.interfaces import IAuthentication, IPrincipalSource
-
-class Term(object):
-
-    def __init__(self, token, title):
-        self.token = token
-        self.title = title
-
-
-class PrincipalTerms(object):
-    implements(ITerms)
-    __used_for__ = IPrincipalSource, IBrowserRequest
-
-    def __init__(self, context, request):
-        self.context = context
-
-    def getTerm(self, principal_id):
-        if principal_id not in self.context:
-            raise LookupError(principal_id)
-
-        auth = getUtility(IAuthentication)
-        principal = auth.getPrincipal(principal_id)
-
-        if principal is None:
-            raise LookupError(principal_id)
-
-        return Term(principal_id.encode('base64').strip().replace('=', '_'),
-                    principal.title)
-
-    def getValue(self, token):
-        return token.replace('_', '=').decode('base64')

Copied: zope.app.security/tags/3.6.1/src/zope/app/security/browser/principalterms.py (from rev 97714, zope.app.security/trunk/src/zope/app/security/browser/principalterms.py)
===================================================================
--- zope.app.security/tags/3.6.1/src/zope/app/security/browser/principalterms.py	                        (rev 0)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/browser/principalterms.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Terms view for Principal Source
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from zope.component import getUtility, adapts
+from zope.interface import implements
+from zope.browser.interfaces import ITerms
+from zope.publisher.interfaces.browser import IBrowserRequest
+
+from zope.app.security.interfaces import IAuthentication, IPrincipalSource
+
+class Term(object):
+
+    def __init__(self, token, title):
+        self.token = token
+        self.title = title
+
+
+class PrincipalTerms(object):
+    implements(ITerms)
+    adapts(IPrincipalSource, IBrowserRequest)
+
+    def __init__(self, context, request):
+        self.context = context
+
+    def getTerm(self, principal_id):
+        if principal_id not in self.context:
+            raise LookupError(principal_id)
+
+        auth = getUtility(IAuthentication)
+        principal = auth.getPrincipal(principal_id)
+
+        if principal is None:
+            raise LookupError(principal_id)
+
+        return Term(principal_id.encode('base64').strip().replace('=', '_'),
+                    principal.title)
+
+    def getValue(self, token):
+        return token.replace('_', '=').decode('base64')

Deleted: zope.app.security/tags/3.6.1/src/zope/app/security/ftpauth.py
===================================================================
--- zope.app.security/trunk/src/zope/app/security/ftpauth.py	2009-03-09 18:30:47 UTC (rev 97713)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/ftpauth.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -1,37 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 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.
-#
-##############################################################################
-"""FTP Standard Authentication adapter
-
-$Id$
-"""
-from zope.publisher.interfaces.ftp import IFTPCredentials
-from loginpassword import LoginPassword
-
-class FTPAuth(LoginPassword):
-    """Adapter for handling common FTP authentication.""" 
-    __used_for__ = IFTPCredentials
-
-    __request = None
-
-    def __init__(self, request):
-        self.__request = request
-        lpw = request._authUserPW()
-        if lpw is None:
-            login, password = None, None
-        else:
-            login, password = lpw
-        LoginPassword.__init__(self, login, password)
-
-    def needLogin(self, realm):
-        self.__request.unauthorized("Did not work")

Copied: zope.app.security/tags/3.6.1/src/zope/app/security/ftpauth.py (from rev 97714, zope.app.security/trunk/src/zope/app/security/ftpauth.py)
===================================================================
--- zope.app.security/tags/3.6.1/src/zope/app/security/ftpauth.py	                        (rev 0)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/ftpauth.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 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.
+#
+##############################################################################
+"""FTP Standard Authentication adapter
+
+$Id$
+"""
+from zope.component import adapts
+from zope.publisher.interfaces.ftp import IFTPCredentials
+from zope.app.security.loginpassword import LoginPassword
+
+class FTPAuth(LoginPassword):
+    """Adapter for handling common FTP authentication."""
+
+    adapts(IFTPCredentials)
+
+    def __init__(self, request):
+        self.__request = request
+        lpw = request._authUserPW()
+        if lpw is None:
+            login, password = None, None
+        else:
+            login, password = lpw
+        super(FTPAuth, self).__init__(login, password)
+
+    def needLogin(self, realm):
+        self.__request.unauthorized("Did not work")

Deleted: zope.app.security/tags/3.6.1/src/zope/app/security/loginpassword.py
===================================================================
--- zope.app.security/trunk/src/zope/app/security/loginpassword.py	2009-03-09 18:30:47 UTC (rev 97713)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/loginpassword.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -1,39 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 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.
-#
-##############################################################################
-"""Login/Password provider
-
-$Id$
-"""
-from zope.interface import implements
-from interfaces import ILoginPassword
-
-class LoginPassword(object):
-
-    implements(ILoginPassword)
-
-    def __init__(self, login, password):
-        self.__login = login
-        if login is None:
-            self.__password = None
-        else:
-            self.__password = password or ""
-
-    def getLogin(self):
-        return self.__login
-
-    def getPassword(self):
-        return self.__password
-
-    def needLogin(self, realm):
-        pass

Copied: zope.app.security/tags/3.6.1/src/zope/app/security/loginpassword.py (from rev 97714, zope.app.security/trunk/src/zope/app/security/loginpassword.py)
===================================================================
--- zope.app.security/tags/3.6.1/src/zope/app/security/loginpassword.py	                        (rev 0)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/loginpassword.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -0,0 +1,39 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 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.
+#
+##############################################################################
+"""Login/Password provider
+
+$Id$
+"""
+from zope.interface import implements
+from zope.app.security.interfaces import ILoginPassword
+
+class LoginPassword(object):
+
+    implements(ILoginPassword)
+
+    def __init__(self, login, password):
+        self.__login = login
+        if login is None:
+            self.__password = None
+        else:
+            self.__password = password or ""
+
+    def getLogin(self):
+        return self.__login
+
+    def getPassword(self):
+        return self.__password
+
+    def needLogin(self, realm):
+        pass

Deleted: zope.app.security/tags/3.6.1/src/zope/app/security/permission.py
===================================================================
--- zope.app.security/trunk/src/zope/app/security/permission.py	2009-03-09 18:30:47 UTC (rev 97713)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/permission.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -1,93 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2002 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.
-#
-##############################################################################
-"""Permissions
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-from persistent import Persistent
-
-from zope.app.security.i18n import _
-from zope.interface import implements
-from zope.location import Location
-from zope.security.interfaces import IPermission
-
-NULL_ID = _('<permission not activated>')
-
-
-class LocalPermission(Persistent, Location):
-    implements(IPermission)
-
-    def __init__(self, title="", description=""):
-        self.id = NULL_ID
-        self.title = title
-        self.description = description
-
-
-def setIdOnActivation(permission, event):
-    """Set the permission id upon registration activation.
-
-    Let's see how this notifier can be used. First we need to create an event
-    using the permission instance and a registration stub:
-
-    >>> class Registration:
-    ...     def __init__(self, obj, name):
-    ...         self.component = obj
-    ...         self.name = name
-
-    >>> perm1 = LocalPermission('Permission 1', 'A first permission')
-    >>> perm1.id
-    u'<permission not activated>'
-
-    >>> import zope.component.interfaces
-    >>> event = zope.component.interfaces.Registered(
-    ...     Registration(perm1, 'perm1'))
-
-    Now we pass the event into this function, and the id of the permission
-    should be set to 'perm1'.
-
-    >>> setIdOnActivation(perm1, event)
-    >>> perm1.id
-    'perm1'
-    """
-    permission.id = event.object.name
-
-
-def unsetIdOnDeactivation(permission, event):
-    """Unset the permission id up registration deactivation.
-
-    Let's see how this notifier can be used. First we need to create an event
-    using the permission instance and a registration stub:
-
-    >>> class Registration:
-    ...     def __init__(self, obj, name):
-    ...         self.component = obj
-    ...         self.name = name
-
-    >>> perm1 = LocalPermission('Permission 1', 'A first permission')
-    >>> perm1.id = 'perm1'
-
-    >>> import zope.component.interfaces
-    >>> event = zope.component.interfaces.Unregistered(
-    ...     Registration(perm1, 'perm1'))
-
-    Now we pass the event into this function, and the id of the permission
-    should be set to NULL_ID.
-
-    >>> unsetIdOnDeactivation(perm1, event)
-    >>> perm1.id
-    u'<permission not activated>'
-    """
-    permission.id = NULL_ID

Copied: zope.app.security/tags/3.6.1/src/zope/app/security/permission.py (from rev 97714, zope.app.security/trunk/src/zope/app/security/permission.py)
===================================================================
--- zope.app.security/tags/3.6.1/src/zope/app/security/permission.py	                        (rev 0)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/permission.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -0,0 +1,92 @@
+##############################################################################
+#
+# Copyright (c) 2002 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.
+#
+##############################################################################
+"""Permissions
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from persistent import Persistent
+from zope.interface import implements
+from zope.location import Location
+from zope.security.interfaces import IPermission
+from zope.app.security.i18n import _
+
+NULL_ID = _('<permission not activated>')
+
+
+class LocalPermission(Persistent, Location):
+    implements(IPermission)
+
+    def __init__(self, title="", description=""):
+        self.id = NULL_ID
+        self.title = title
+        self.description = description
+
+
+def setIdOnActivation(permission, event):
+    """Set the permission id upon registration activation.
+
+    Let's see how this notifier can be used. First we need to create an event
+    using the permission instance and a registration stub:
+
+    >>> class Registration:
+    ...     def __init__(self, obj, name):
+    ...         self.component = obj
+    ...         self.name = name
+
+    >>> perm1 = LocalPermission('Permission 1', 'A first permission')
+    >>> perm1.id
+    u'<permission not activated>'
+
+    >>> import zope.component.interfaces
+    >>> event = zope.component.interfaces.Registered(
+    ...     Registration(perm1, 'perm1'))
+
+    Now we pass the event into this function, and the id of the permission
+    should be set to 'perm1'.
+
+    >>> setIdOnActivation(perm1, event)
+    >>> perm1.id
+    'perm1'
+    """
+    permission.id = event.object.name
+
+
+def unsetIdOnDeactivation(permission, event):
+    """Unset the permission id up registration deactivation.
+
+    Let's see how this notifier can be used. First we need to create an event
+    using the permission instance and a registration stub:
+
+    >>> class Registration:
+    ...     def __init__(self, obj, name):
+    ...         self.component = obj
+    ...         self.name = name
+
+    >>> perm1 = LocalPermission('Permission 1', 'A first permission')
+    >>> perm1.id = 'perm1'
+
+    >>> import zope.component.interfaces
+    >>> event = zope.component.interfaces.Unregistered(
+    ...     Registration(perm1, 'perm1'))
+
+    Now we pass the event into this function, and the id of the permission
+    should be set to NULL_ID.
+
+    >>> unsetIdOnDeactivation(perm1, event)
+    >>> perm1.id
+    u'<permission not activated>'
+    """
+    permission.id = NULL_ID

Deleted: zope.app.security/tags/3.6.1/src/zope/app/security/principalregistry.py
===================================================================
--- zope.app.security/trunk/src/zope/app/security/principalregistry.py	2009-03-09 18:30:47 UTC (rev 97713)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/principalregistry.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -1,201 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 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.
-#
-##############################################################################
-"""Global Authentication Utility or Principal Registry
-
-$Id$
-"""
-from zope.component import getUtility
-from zope.interface import implements
-
-from zope.app.security.interfaces import PrincipalLookupError
-from zope.security.interfaces import IGroupAwarePrincipal
-import zope.security.management
-from zope.app.security import interfaces
-from zope.container.contained import Contained, contained
-from zope.password.interfaces import IPasswordManager
-
-
-class DuplicateLogin(Exception): pass
-class DuplicateId(Exception): pass
-
-class PrincipalRegistry(object):
-
-    implements(interfaces.IAuthentication, interfaces.ILogout)
-
-    # Methods implementing IAuthentication
-
-    def authenticate(self, request):
-        a = interfaces.ILoginPassword(request, None)
-        if a is not None:
-            login = a.getLogin()
-            if login is not None:
-                p = self.__principalsByLogin.get(login, None)
-                if p is not None:
-                    password = a.getPassword()
-                    if p.validate(password):
-                        return p
-        return None
-
-    __defaultid = None
-    __defaultObject = None
-
-    def defineDefaultPrincipal(self, id, title, description='',
-                               principal=None):
-        if id in self.__principalsById:
-            raise DuplicateId(id)
-        self.__defaultid = id
-        if principal is None:
-            principal = UnauthenticatedPrincipal(id, title, description)
-        self.__defaultObject = contained(principal, self, id)
-        return principal
-
-    def unauthenticatedPrincipal(self):
-        return self.__defaultObject
-
-    def unauthorized(self, id, request):
-        if id is None or id is self.__defaultid:
-            a = interfaces.ILoginPassword(request)
-            a.needLogin(realm="Zope")
-
-    def getPrincipal(self, id):
-        r = self.__principalsById.get(id)
-        if r is None:
-            if id == self.__defaultid:
-                return self.__defaultObject
-            if id == zope.security.management.system_user.id:
-                return zope.security.management.system_user
-            raise PrincipalLookupError(id)
-        return r
-
-    def getPrincipalByLogin(self, login):
-        return self.__principalsByLogin[login]
-
-    def getPrincipals(self, name):
-        name = name.lower()
-        return [p for p in self.__principalsById.itervalues()
-                  if p.title.lower().startswith(name) or
-                     p.getLogin().lower().startswith(name)]
-
-    def logout(self, request):
-        # not supporting basic auth logout -- no such thing
-        pass
-
-    # Management methods
-
-    def __init__(self):
-        self.__principalsById = {}
-        self.__principalsByLogin = {}
-
-    def definePrincipal(self, principal, title, description='',
-            login='', password='', passwordManagerName='Plain Text'):
-        id=principal
-        if login in self.__principalsByLogin:
-            raise DuplicateLogin(login)
-
-        if id in self.__principalsById or id == self.__defaultid:
-            raise DuplicateId(id)
-
-        p = Principal(id, title, description,
-            login, password, passwordManagerName)
-        p = contained(p, self, id)
-
-        self.__principalsByLogin[login] = p
-        self.__principalsById[id] = p
-
-        return p
-
-    def registerGroup(self, group):
-        id = group.id
-        if id in self.__principalsById or id == self.__defaultid:
-            raise DuplicateId(id)
-
-        self.__principalsById[group.id] = group
-
-    def _clear(self):
-        self.__init__()
-        self.__defaultid = None
-        self.__defaultObject = None
-
-principalRegistry = PrincipalRegistry()
-
-# Register our cleanup with Testing.CleanUp to make writing unit tests
-# simpler.
-try:
-    from zope.testing.cleanup import addCleanUp
-except ImportError:
-    pass
-else:
-    addCleanUp(principalRegistry._clear)
-    del addCleanUp
-
-class PrincipalBase(Contained):
-
-    def __init__(self, id, title, description):
-        self.id = id
-        self.title = title
-        self.description = description
-        self.groups = []
-
-class Group(PrincipalBase):
-
-    def getLogin(self):
-        return '' # to make registry search happy
-
-class Principal(PrincipalBase):
-
-    implements(IGroupAwarePrincipal)
-
-    def __init__(self, id, title, description, login,
-            pw, pwManagerName="Plain Text"):
-        super(Principal, self).__init__(id, title, description)
-        self.__login = login
-        self.__pwManagerName = pwManagerName
-        self.__pw = pw
-
-    def __getPasswordManager(self):
-        return getUtility(IPasswordManager, self.__pwManagerName)
-
-    def getLogin(self):
-        return self.__login
-
-    def validate(self, pw):
-        pwManager = self.__getPasswordManager()
-        return pwManager.checkPassword(self.__pw, pw)
-
-
-class UnauthenticatedPrincipal(PrincipalBase):
-
-    implements(interfaces.IUnauthenticatedPrincipal)
-
-
-fallback_unauthenticated_principal = (
-    UnauthenticatedPrincipal(
-        __name__+'.fallback_unauthenticated_principal',
-        'Fallback unauthenticated principal',
-        'The default unauthenticated principal. Used as a fallback to '
-        'allow challenging for a user even if the IAuthentication returned '
-        'None as the unauthenticated principal.'))
-
-
-class UnauthenticatedGroup(Group):
-
-    implements(interfaces.IUnauthenticatedGroup)
-
-class AuthenticatedGroup(Group):
-
-    implements(interfaces.IAuthenticatedGroup)
-
-class EverybodyGroup(Group):
-
-    implements(interfaces.IEveryoneGroup)

Copied: zope.app.security/tags/3.6.1/src/zope/app/security/principalregistry.py (from rev 97714, zope.app.security/trunk/src/zope/app/security/principalregistry.py)
===================================================================
--- zope.app.security/tags/3.6.1/src/zope/app/security/principalregistry.py	                        (rev 0)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/principalregistry.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -0,0 +1,204 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 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.
+#
+##############################################################################
+"""Global Authentication Utility or Principal Registry
+
+$Id$
+"""
+from zope.component import getUtility
+from zope.interface import implements
+from zope.container.contained import Contained, contained
+
+import zope.security.management
+from zope.security.interfaces import IGroupAwarePrincipal
+from zope.password.interfaces import IPasswordManager
+
+from zope.app.security import interfaces
+
+
+class DuplicateLogin(Exception):
+    pass
+
+class DuplicateId(Exception):
+    pass
+
+class PrincipalRegistry(object):
+
+    implements(interfaces.IAuthentication, interfaces.ILogout)
+
+    # Methods implementing IAuthentication
+
+    def authenticate(self, request):
+        a = interfaces.ILoginPassword(request, None)
+        if a is not None:
+            login = a.getLogin()
+            if login is not None:
+                p = self.__principalsByLogin.get(login, None)
+                if p is not None:
+                    password = a.getPassword()
+                    if p.validate(password):
+                        return p
+        return None
+
+    __defaultid = None
+    __defaultObject = None
+
+    def defineDefaultPrincipal(self, id, title, description='',
+                               principal=None):
+        if id in self.__principalsById:
+            raise DuplicateId(id)
+        self.__defaultid = id
+        if principal is None:
+            principal = UnauthenticatedPrincipal(id, title, description)
+        self.__defaultObject = contained(principal, self, id)
+        return principal
+
+    def unauthenticatedPrincipal(self):
+        return self.__defaultObject
+
+    def unauthorized(self, id, request):
+        if id is None or id is self.__defaultid:
+            a = interfaces.ILoginPassword(request)
+            a.needLogin(realm="Zope")
+
+    def getPrincipal(self, id):
+        r = self.__principalsById.get(id)
+        if r is None:
+            if id == self.__defaultid:
+                return self.__defaultObject
+            if id == zope.security.management.system_user.id:
+                return zope.security.management.system_user
+            raise interfaces.PrincipalLookupError(id)
+        return r
+
+    def getPrincipalByLogin(self, login):
+        return self.__principalsByLogin[login]
+
+    def getPrincipals(self, name):
+        name = name.lower()
+        return [p for p in self.__principalsById.itervalues()
+                  if p.title.lower().startswith(name) or
+                     p.getLogin().lower().startswith(name)]
+
+    def logout(self, request):
+        # not supporting basic auth logout -- no such thing
+        pass
+
+    # Management methods
+
+    def __init__(self):
+        self.__principalsById = {}
+        self.__principalsByLogin = {}
+
+    def definePrincipal(self, principal, title, description='',
+            login='', password='', passwordManagerName='Plain Text'):
+        id=principal
+        if login in self.__principalsByLogin:
+            raise DuplicateLogin(login)
+
+        if id in self.__principalsById or id == self.__defaultid:
+            raise DuplicateId(id)
+
+        p = Principal(id, title, description,
+            login, password, passwordManagerName)
+        p = contained(p, self, id)
+
+        self.__principalsByLogin[login] = p
+        self.__principalsById[id] = p
+
+        return p
+
+    def registerGroup(self, group):
+        id = group.id
+        if id in self.__principalsById or id == self.__defaultid:
+            raise DuplicateId(id)
+
+        self.__principalsById[group.id] = group
+
+    def _clear(self):
+        self.__init__()
+        self.__defaultid = None
+        self.__defaultObject = None
+
+principalRegistry = PrincipalRegistry()
+
+# Register our cleanup with Testing.CleanUp to make writing unit tests
+# simpler.
+try:
+    from zope.testing.cleanup import addCleanUp
+except ImportError:
+    pass
+else:
+    addCleanUp(principalRegistry._clear)
+    del addCleanUp
+
+class PrincipalBase(Contained):
+
+    def __init__(self, id, title, description):
+        self.id = id
+        self.title = title
+        self.description = description
+        self.groups = []
+
+class Group(PrincipalBase):
+
+    def getLogin(self):
+        return '' # to make registry search happy
+
+class Principal(PrincipalBase):
+
+    implements(IGroupAwarePrincipal)
+
+    def __init__(self, id, title, description, login,
+            pw, pwManagerName="Plain Text"):
+        super(Principal, self).__init__(id, title, description)
+        self.__login = login
+        self.__pwManagerName = pwManagerName
+        self.__pw = pw
+
+    def __getPasswordManager(self):
+        return getUtility(IPasswordManager, self.__pwManagerName)
+
+    def getLogin(self):
+        return self.__login
+
+    def validate(self, pw):
+        pwManager = self.__getPasswordManager()
+        return pwManager.checkPassword(self.__pw, pw)
+
+
+class UnauthenticatedPrincipal(PrincipalBase):
+
+    implements(interfaces.IUnauthenticatedPrincipal)
+
+
+fallback_unauthenticated_principal = (
+    UnauthenticatedPrincipal(
+        __name__+'.fallback_unauthenticated_principal',
+        'Fallback unauthenticated principal',
+        'The default unauthenticated principal. Used as a fallback to '
+        'allow challenging for a user even if the IAuthentication returned '
+        'None as the unauthenticated principal.'))
+
+
+class UnauthenticatedGroup(Group):
+
+    implements(interfaces.IUnauthenticatedGroup)
+
+class AuthenticatedGroup(Group):
+
+    implements(interfaces.IAuthenticatedGroup)
+
+class EverybodyGroup(Group):
+
+    implements(interfaces.IEveryoneGroup)

Deleted: zope.app.security/tags/3.6.1/src/zope/app/security/vocabulary.py
===================================================================
--- zope.app.security/trunk/src/zope/app/security/vocabulary.py	2009-03-09 18:30:47 UTC (rev 97713)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/vocabulary.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -1,222 +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.
-#
-##############################################################################
-"""Permission Id Vocabulary.
-
-This vocabulary provides permission IDs.
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-import zope.component
-from zope.interface import implements, classProvides
-from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
-from zope.schema.interfaces import ISourceQueriables, IVocabularyFactory
-from zope.security.interfaces import IPermission
-from zope.security.checker import CheckerPublic
-
-from zope.app.security.interfaces import IAuthentication
-from zope.app.security.interfaces import PrincipalLookupError
-from zope.app.security.interfaces import IPrincipalSource
-from zope.app.component import queryNextUtility
-from zope.app.component.vocabulary import UtilityVocabulary
-
-
-class PermissionsVocabulary(UtilityVocabulary):
-    classProvides(IVocabularyFactory)
-    interface = IPermission
-
-class PermissionIdsVocabulary(SimpleVocabulary):
-    """A vocabular of permission IDs.
-
-    Term values are the permission ID strings except for 'zope.Public', which
-    is the global permission CheckerPublic.
-
-    Term titles are the permission ID strings except for 'zope.Public', which
-    is shortened to 'Public'.
-
-    Terms are sorted by title except for 'Public', which always appears as
-    the first term.
-
-    To illustrate, we need to register the permission IDs vocab:
-
-    >>> from zope.app.testing.placelesssetup import setUp, tearDown
-    >>> setUp()
-    >>> from zope.schema.vocabulary import getVocabularyRegistry
-    >>> registry = getVocabularyRegistry()
-    >>> registry.register('Permission Ids', PermissionIdsVocabulary)
-
-    We also need to register some sample permission utilities, including
-    the special permission 'zope.Public':
-
-    >>> from zope.security.interfaces import IPermission
-    >>> from zope.security.permission import Permission
-    >>> from zope.app.testing import ztapi
-    >>> ztapi.provideUtility(IPermission, Permission('zope.Public'),
-    ...     'zope.Public')
-    >>> ztapi.provideUtility(IPermission, Permission('b'), 'b')
-    >>> ztapi.provideUtility(IPermission, Permission('a'), 'a')
-
-    We can now lookup these permissions using the vocabulary:
-
-    >>> vocab = registry.get(None, 'Permission Ids')
-
-    The non-public permissions 'a' and 'b' are string values:
-
-    >>> vocab.getTermByToken('a').value
-    u'a'
-    >>> vocab.getTermByToken('b').value
-    u'b'
-
-    However, the public permission value is CheckerPublic:
-
-    >>> vocab.getTermByToken('zope.Public').value is CheckerPublic
-    True
-
-    and its title is shortened:
-
-    >>> vocab.getTermByToken('zope.Public').title
-    u'Public'
-
-    The terms are sorted by title except for the public permission, which is
-    listed first:
-
-    >>> [term.title for term in vocab]
-    [u'Public', u'a', u'b']
-
-    >>> tearDown()
-    """
-    classProvides(IVocabularyFactory)
-
-    def __init__(self, context):
-        terms = []
-        permissions = zope.component.getUtilitiesFor(IPermission, context)
-        for name, permission in permissions:
-            if name == 'zope.Public':
-                terms.append(SimpleTerm(
-                    CheckerPublic, 'zope.Public', u'Public'))
-            else:
-                terms.append(SimpleTerm(name, name, name))
-        terms.sort(lambda lhs, rhs: \
-            lhs.title == u'Public' and -1 or cmp(lhs.title, rhs.title))
-        super(PermissionIdsVocabulary, self).__init__(terms)
-
-
-class PrincipalSource(object):
-    """Generic Principal Source"""
-    implements(IPrincipalSource, ISourceQueriables)
-
-    def __contains__(self, id):
-        """Test for the existence of a user.
-
-        We want to check whether the system knows about a particular
-        principal, which is referenced via its id. The source will go through
-        the most local authentication utility to look for the
-        principal. Whether the utility consults other utilities to give an
-        answer is up to the utility itself.
-
-        First we need to create a dummy utility that will return a user, if
-        the id is 'bob'.
-
-        >>> class DummyUtility:
-        ...     def getPrincipal(self, id):
-        ...         if id == 'bob':
-        ...             return id
-        ...         raise PrincipalLookupError(id)
-
-        Since we do not want to bring up the entire component architecture, we
-        simply monkey patch the `getUtility()` method to always return our
-        dummy authentication utility.
-
-        >>> temp = zope.component.getUtility
-        >>> zope.component.getUtility = lambda iface: DummyUtility()
-
-        Now initialize the principal source and test the method
-
-        >>> source = PrincipalSource()
-        >>> 'jim' in source
-        False
-        >>> 'bob' in source
-        True
-
-        Now revert our patch.
-
-        >>> zope.component.getUtility = temp
-        """
-        auth = zope.component.getUtility(IAuthentication)
-        try:
-            auth.getPrincipal(id)
-        except PrincipalLookupError:
-            return False
-        else:
-            return True
-
-    def getQueriables(self):
-        """Returns an iteratable of queriables.
-
-        Queriables are responsible for providing interfaces to search for
-        principals by a set of given parameters (can be different for the
-        various queriables). This method will walk up through all of the
-        authentication utilities to look for queriables.
-
-        >>> class DummyUtility1:
-        ...     implements(IAuthentication)
-        ...     __parent__ = None
-        ...     def __repr__(self): return 'dummy1'
-        >>> dummy1 = DummyUtility1()
-
-        >>> class DummyUtility2:
-        ...     implements(ISourceQueriables, IAuthentication)
-        ...     __parent__ = None
-        ...     def getQueriables(self):
-        ...         return ('1', 1), ('2', 2), ('3', 3)
-        >>> dummy2 = DummyUtility2()
-
-        >>> class DummyUtility3(DummyUtility2):
-        ...     implements(IAuthentication)
-        ...     def getQueriables(self):
-        ...         return ('4', 4),
-        >>> dummy3 = DummyUtility3()
-
-        >>> from zope.app.component.testing import testingNextUtility
-        >>> testingNextUtility(dummy1, dummy2, IAuthentication)
-        >>> testingNextUtility(dummy2, dummy3, IAuthentication)
-
-        >>> temp = zope.component.getUtility
-        >>> zope.component.getUtility = lambda iface: dummy1
-
-        >>> source = PrincipalSource()
-        >>> list(source.getQueriables())
-        [(u'0', dummy1), (u'1.1', 1), (u'1.2', 2), (u'1.3', 3), (u'2.4', 4)]
-
-        >>> zope.component.getUtility = temp
-        """
-        i = 0
-        auth = zope.component.getUtility(IAuthentication)
-        yielded = []
-        while True:
-            queriables = ISourceQueriables(auth, None)
-            if queriables is None:
-                yield unicode(i), auth
-            else:
-                for qid, queriable in queriables.getQueriables():
-                    # ensure that we dont return same yielded utility more
-                    # then once
-                    if queriable not in yielded:
-                        yield unicode(i)+'.'+unicode(qid), queriable
-                        yielded.append(queriable)
-            auth = queryNextUtility(auth, IAuthentication)
-            if auth is None:
-                break
-            i += 1

Copied: zope.app.security/tags/3.6.1/src/zope/app/security/vocabulary.py (from rev 97714, zope.app.security/trunk/src/zope/app/security/vocabulary.py)
===================================================================
--- zope.app.security/tags/3.6.1/src/zope/app/security/vocabulary.py	                        (rev 0)
+++ zope.app.security/tags/3.6.1/src/zope/app/security/vocabulary.py	2009-03-09 19:03:27 UTC (rev 97716)
@@ -0,0 +1,222 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Permission Id Vocabulary.
+
+This vocabulary provides permission IDs.
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+import zope.component
+from zope.interface import implements, classProvides
+from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
+from zope.schema.interfaces import ISourceQueriables, IVocabularyFactory
+from zope.security.interfaces import IPermission
+from zope.security.checker import CheckerPublic
+from zope.site.next import queryNextUtility
+
+from zope.app.security.interfaces import IAuthentication
+from zope.app.security.interfaces import IPrincipalSource
+from zope.app.security.interfaces import PrincipalLookupError
+from zope.app.component.vocabulary import UtilityVocabulary
+
+
+class PermissionsVocabulary(UtilityVocabulary):
+    classProvides(IVocabularyFactory)
+    interface = IPermission
+
+class PermissionIdsVocabulary(SimpleVocabulary):
+    """A vocabular of permission IDs.
+
+    Term values are the permission ID strings except for 'zope.Public', which
+    is the global permission CheckerPublic.
+
+    Term titles are the permission ID strings except for 'zope.Public', which
+    is shortened to 'Public'.
+
+    Terms are sorted by title except for 'Public', which always appears as
+    the first term.
+
+    To illustrate, we need to register the permission IDs vocab:
+
+    >>> from zope.app.testing.placelesssetup import setUp, tearDown
+    >>> setUp()
+    >>> from zope.schema.vocabulary import getVocabularyRegistry
+    >>> registry = getVocabularyRegistry()
+    >>> registry.register('Permission Ids', PermissionIdsVocabulary)
+
+    We also need to register some sample permission utilities, including
+    the special permission 'zope.Public':
+
+    >>> from zope.security.interfaces import IPermission
+    >>> from zope.security.permission import Permission
+    >>> from zope.app.testing import ztapi
+    >>> ztapi.provideUtility(IPermission, Permission('zope.Public'),
+    ...     'zope.Public')
+    >>> ztapi.provideUtility(IPermission, Permission('b'), 'b')
+    >>> ztapi.provideUtility(IPermission, Permission('a'), 'a')
+
+    We can now lookup these permissions using the vocabulary:
+
+    >>> vocab = registry.get(None, 'Permission Ids')
+
+    The non-public permissions 'a' and 'b' are string values:
+
+    >>> vocab.getTermByToken('a').value
+    u'a'
+    >>> vocab.getTermByToken('b').value
+    u'b'
+
+    However, the public permission value is CheckerPublic:
+
+    >>> vocab.getTermByToken('zope.Public').value is CheckerPublic
+    True
+
+    and its title is shortened:
+
+    >>> vocab.getTermByToken('zope.Public').title
+    u'Public'
+
+    The terms are sorted by title except for the public permission, which is
+    listed first:
+
+    >>> [term.title for term in vocab]
+    [u'Public', u'a', u'b']
+
+    >>> tearDown()
+    """
+    classProvides(IVocabularyFactory)
+
+    def __init__(self, context):
+        terms = []
+        permissions = zope.component.getUtilitiesFor(IPermission, context)
+        for name, permission in permissions:
+            if name == 'zope.Public':
+                terms.append(SimpleTerm(
+                    CheckerPublic, 'zope.Public', u'Public'))
+            else:
+                terms.append(SimpleTerm(name, name, name))
+        terms.sort(lambda lhs, rhs: \
+            lhs.title == u'Public' and -1 or cmp(lhs.title, rhs.title))
+        super(PermissionIdsVocabulary, self).__init__(terms)
+
+
+class PrincipalSource(object):
+    """Generic Principal Source"""
+    implements(IPrincipalSource, ISourceQueriables)
+
+    def __contains__(self, id):
+        """Test for the existence of a user.
+
+        We want to check whether the system knows about a particular
+        principal, which is referenced via its id. The source will go through
+        the most local authentication utility to look for the
+        principal. Whether the utility consults other utilities to give an
+        answer is up to the utility itself.
+
+        First we need to create a dummy utility that will return a user, if
+        the id is 'bob'.
+
+        >>> class DummyUtility:
+        ...     def getPrincipal(self, id):
+        ...         if id == 'bob':
+        ...             return id
+        ...         raise PrincipalLookupError(id)
+
+        Since we do not want to bring up the entire component architecture, we
+        simply monkey patch the `getUtility()` method to always return our
+        dummy authentication utility.
+
+        >>> temp = zope.component.getUtility
+        >>> zope.component.getUtility = lambda iface: DummyUtility()
+
+        Now initialize the principal source and test the method
+
+        >>> source = PrincipalSource()
+        >>> 'jim' in source
+        False
+        >>> 'bob' in source
+        True
+
+        Now revert our patch.
+
+        >>> zope.component.getUtility = temp
+        """
+        auth = zope.component.getUtility(IAuthentication)
+        try:
+            auth.getPrincipal(id)
+        except PrincipalLookupError:
+            return False
+        else:
+            return True
+
+    def getQueriables(self):
+        """Returns an iteratable of queriables.
+
+        Queriables are responsible for providing interfaces to search for
+        principals by a set of given parameters (can be different for the
+        various queriables). This method will walk up through all of the
+        authentication utilities to look for queriables.
+
+        >>> class DummyUtility1:
+        ...     implements(IAuthentication)
+        ...     __parent__ = None
+        ...     def __repr__(self): return 'dummy1'
+        >>> dummy1 = DummyUtility1()
+
+        >>> class DummyUtility2:
+        ...     implements(ISourceQueriables, IAuthentication)
+        ...     __parent__ = None
+        ...     def getQueriables(self):
+        ...         return ('1', 1), ('2', 2), ('3', 3)
+        >>> dummy2 = DummyUtility2()
+
+        >>> class DummyUtility3(DummyUtility2):
+        ...     implements(IAuthentication)
+        ...     def getQueriables(self):
+        ...         return ('4', 4),
+        >>> dummy3 = DummyUtility3()
+
+        >>> from zope.app.component.testing import testingNextUtility
+        >>> testingNextUtility(dummy1, dummy2, IAuthentication)
+        >>> testingNextUtility(dummy2, dummy3, IAuthentication)
+
+        >>> temp = zope.component.getUtility
+        >>> zope.component.getUtility = lambda iface: dummy1
+
+        >>> source = PrincipalSource()
+        >>> list(source.getQueriables())
+        [(u'0', dummy1), (u'1.1', 1), (u'1.2', 2), (u'1.3', 3), (u'2.4', 4)]
+
+        >>> zope.component.getUtility = temp
+        """
+        i = 0
+        auth = zope.component.getUtility(IAuthentication)
+        yielded = []
+        while True:
+            queriables = ISourceQueriables(auth, None)
+            if queriables is None:
+                yield unicode(i), auth
+            else:
+                for qid, queriable in queriables.getQueriables():
+                    # ensure that we dont return same yielded utility more
+                    # then once
+                    if queriable not in yielded:
+                        yield unicode(i)+'.'+unicode(qid), queriable
+                        yielded.append(queriable)
+            auth = queryNextUtility(auth, IAuthentication)
+            if auth is None:
+                break
+            i += 1



More information about the Checkins mailing list