[Checkins] SVN: zope.principalregistry/trunk/ Checkpoint. Tests pass. Still needs polishing and review.
Dan Korostelev
nadako at gmail.com
Wed Mar 11 22:11:15 EDT 2009
Log message for revision 97946:
Checkpoint. Tests pass. Still needs polishing and review.
Also, there's unwanted dependency on zope.container :-( Need to discuss.
Changed:
U zope.principalregistry/trunk/CHANGES.txt
U zope.principalregistry/trunk/README.txt
U zope.principalregistry/trunk/buildout.cfg
U zope.principalregistry/trunk/setup.py
D zope.principalregistry/trunk/src/zope/app/
A zope.principalregistry/trunk/src/zope/principalregistry/
A zope.principalregistry/trunk/src/zope/principalregistry/README.txt
U zope.principalregistry/trunk/src/zope/principalregistry/__init__.py
D zope.principalregistry/trunk/src/zope/principalregistry/_protections.py
D zope.principalregistry/trunk/src/zope/principalregistry/_protections.zcml
D zope.principalregistry/trunk/src/zope/principalregistry/basicauthadapter.py
D zope.principalregistry/trunk/src/zope/principalregistry/browser/
U zope.principalregistry/trunk/src/zope/principalregistry/configure.zcml
D zope.principalregistry/trunk/src/zope/principalregistry/ftpauth.py
D zope.principalregistry/trunk/src/zope/principalregistry/globalmodules.zcml
D zope.principalregistry/trunk/src/zope/principalregistry/globalprincipals.txt
D zope.principalregistry/trunk/src/zope/principalregistry/i18n.py
D zope.principalregistry/trunk/src/zope/principalregistry/interfaces.py
D zope.principalregistry/trunk/src/zope/principalregistry/loginpassword.py
U zope.principalregistry/trunk/src/zope/principalregistry/meta.zcml
U zope.principalregistry/trunk/src/zope/principalregistry/metaconfigure.py
D zope.principalregistry/trunk/src/zope/principalregistry/permission.py
D zope.principalregistry/trunk/src/zope/principalregistry/principal.py
D zope.principalregistry/trunk/src/zope/principalregistry/principallogging.py
U zope.principalregistry/trunk/src/zope/principalregistry/principalregistry.py
D zope.principalregistry/trunk/src/zope/principalregistry/protectclass.py
D zope.principalregistry/trunk/src/zope/principalregistry/settings.py
U zope.principalregistry/trunk/src/zope/principalregistry/tests/__init__.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/perm.zcml
D zope.principalregistry/trunk/src/zope/principalregistry/tests/perm_duplicate.zcml
U zope.principalregistry/trunk/src/zope/principalregistry/tests/principal.zcml
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_basicauthadapter.py
A zope.principalregistry/trunk/src/zope/principalregistry/tests/test_doc.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_ftpauth.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_interfaces.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_loginpassword.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_logout.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_permission.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principal.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principallogging.py
U zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principalregistry.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_securitydirectives.py
D zope.principalregistry/trunk/src/zope/principalregistry/tests/test_vocabulary.py
D zope.principalregistry/trunk/src/zope/principalregistry/vocabulary.py
-=-
Modified: zope.principalregistry/trunk/CHANGES.txt
===================================================================
--- zope.principalregistry/trunk/CHANGES.txt 2009-03-12 01:35:29 UTC (rev 97945)
+++ zope.principalregistry/trunk/CHANGES.txt 2009-03-12 02:11:13 UTC (rev 97946)
@@ -5,112 +5,6 @@
3.7.0 (unreleased)
------------------
-- All interfaces, as well as some authentication-related helper classes and
- functions (checkPrincipal, PrincipalSource, PrincipalTerms, etc.) were moved
- into the new ``zope.authentication`` package. Backward-compatibility imports
- are provided.
-
-- The IPrincipal -> zope.publisher.interfaces.logginginfo.ILoggingInfo
- adapter was moved to ``zope.publisher``. Backward-compatibility import
- is provided.
-
-- The PermissionsVocabulary and PermissionIdsVocabulary has been moved
- to the ``zope.security`` package. Backward-compatibility imports are
- provided.
-
-- The registration of the "zope.Public" permission has been moved to
- ``zope.security``. Its configure.zcml is now included by this package.
-
-- The ``LocalPermission`` class is now moved to new ``zope.localpermission``
- package. This package now only has backward-compatibility imports and browser
- views and menu items for ZMI.
-
-- The browser views and menu item for ``LocalPermission`` was moved into a
- separate `browser/localpermission.zcml` file that is included by
- `browser/configure.zcml`. This adds a possibility to exclude ZMI-related
- configuration for local permissions.
-
-3.6.2 (2009-03-10)
-------------------
-
-- The `Allow`, `Deny` and `Unset` permission settings was preferred to
- be imported from ``zope.securitypolicy.interfaces`` for a long time
- and now they are completely moved there from ``zope.app.security.settings``
- as well as the ``PermissionSetting`` class. The only thing left for
- backward compatibility is the import of Allow/Unset/Deny constants if
- ``zope.securitypolicy`` is installed to allow unpickling of security
- settings.
-
-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.
+Initial release. This package was splitted from zope.app.security as a part
+of the refactoring process to provide global principal registry without extra
+dependencies.
Modified: zope.principalregistry/trunk/README.txt
===================================================================
--- zope.principalregistry/trunk/README.txt 2009-03-12 01:35:29 UTC (rev 97945)
+++ zope.principalregistry/trunk/README.txt 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,2 +1,2 @@
-This package provides several components integrating the Zope security
-implementation into zope 3 applications.
+This package provides an authentication utility for zope.authentication that
+uses simple non-persistent principal registry.
Modified: zope.principalregistry/trunk/buildout.cfg
===================================================================
--- zope.principalregistry/trunk/buildout.cfg 2009-03-12 01:35:29 UTC (rev 97945)
+++ zope.principalregistry/trunk/buildout.cfg 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,24 +1,14 @@
[buildout]
-parts = test coverage-test coverage-report
-develop = .
- ../zope.authentication
- ../zope.localpermission
- ../zope.publisher
- ../zope.security
-
- ../zope.component
- ../../zope.app.testing
- ../../zope.container
- ../../zope.app.publisher
-# these are needed until we get new zope.component released
+parts = test coverage-test coverage-report
+develop = . ../zope.authentication
[test]
recipe = zc.recipe.testrunner
-eggs = zope.app.security [test]
+eggs = zope.principalregistry
[coverage-test]
recipe = zc.recipe.testrunner
-eggs = zope.app.security [test]
+eggs = zope.principalregistry
defaults = ['--coverage', '../../coverage']
[coverage-report]
Modified: zope.principalregistry/trunk/setup.py
===================================================================
--- zope.principalregistry/trunk/setup.py 2009-03-12 01:35:29 UTC (rev 97945)
+++ zope.principalregistry/trunk/setup.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Setup for zope.app.security package
+"""Setup for zope.principalregistry package
$Id$
"""
@@ -21,27 +21,17 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-setup(name='zope.app.security',
+setup(name='zope.principalregistry',
version = '3.7.0dev',
author='Zope Corporation and Contributors',
author_email='zope-dev at zope.org',
- description='Security Components for Zope 3 Applications',
+ description='Global principal registry component for Zope3',
long_description=(
- read('README.txt')
+ read('src', 'zope', 'principalregistry', 'README.txt')
+ '\n\n' +
- 'Detailed Documentation\n' +
- '======================\n'
- + '\n\n' +
- read('src', 'zope', 'app', 'security', 'globalprincipals.txt')
- + '\n\n' +
- read('src', 'zope', 'app', 'security', 'browser',
- 'authutilitysearchview.txt')
- + '\n\n' +
- read('src', 'zope', 'app', 'security', 'browser', 'loginlogout.txt')
- + '\n\n' +
read('CHANGES.txt')
),
- keywords = "zope3 security authentication principal ftp http",
+ keywords = "zope security authentication principal registry",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
@@ -52,32 +42,19 @@
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope3'],
- url='http://pypi.python.org/pypi/zope.app.security',
+ url='http://pypi.python.org/pypi/zope.principalregistry',
license='ZPL 2.1',
packages=find_packages('src'),
package_dir = {'': 'src'},
- namespace_packages=['zope', 'zope.app'],
- extras_require=dict(test=['zope.app.testing']),
+ namespace_packages=['zope'],
install_requires=['setuptools',
- 'zope.browser',
- 'zope.app.component',
- 'zope.app.form',
- 'zope.app.pagetemplate',
- 'zope.app.publisher',
'zope.authentication',
'zope.component',
- 'zope.configuration',
- 'zope.container',
- 'zope.i18n',
- 'zope.i18nmessageid',
'zope.interface',
- 'zope.localpermission',
'zope.password',
- 'zope.publisher',
- 'zope.schema',
'zope.security',
- 'zope.site',
- 'ZODB3',
+
+ 'zope.container', # XXX: THIS IS BAD
],
include_package_data = True,
zip_safe = False,
Copied: zope.principalregistry/trunk/src/zope/principalregistry/README.txt (from rev 97944, zope.principalregistry/trunk/src/zope/app/security/globalprincipals.txt)
===================================================================
--- zope.principalregistry/trunk/src/zope/principalregistry/README.txt (rev 0)
+++ zope.principalregistry/trunk/src/zope/principalregistry/README.txt 2009-03-12 02:11:13 UTC (rev 97946)
@@ -0,0 +1,292 @@
+===========================
+Global principal definition
+===========================
+
+Global principals are defined via ZCML. There are several kinds of
+principals that can be defined.
+
+Authenticated Users
+-------------------
+
+There are principals that can log in:
+
+ >>> zcml("""
+ ... <configure xmlns="http://namespaces.zope.org/zope">
+ ...
+ ... <principal
+ ... id="zope.manager"
+ ... title="Manager"
+ ... description="System Manager"
+ ... login="admin"
+ ... password_manager="SHA1"
+ ... password="40bd001563085fc35165329ea1ff5c5ecbdbbeef"
+ ... />
+ ...
+ ... </configure>
+ ... """)
+
+ >>> import pprint
+ >>> from zope.principalregistry.principalregistry import principalRegistry
+ >>> [p] = principalRegistry.getPrincipals('')
+ >>> p.id, p.title, p.description, p.getLogin(), p.validate('123')
+ ('zope.manager', u'Manager', u'System Manager', u'admin', True)
+
+The unauthenticated principal
+-----------------------------
+
+There is the unauthenticated principal:
+
+ >>> zcml("""
+ ... <configure
+ ... xmlns="http://namespaces.zope.org/zope"
+ ... >
+ ...
+ ... <unauthenticatedPrincipal
+ ... id="zope.unknown"
+ ... title="Anonymous user"
+ ... description="A person we don't know"
+ ... />
+ ...
+ ... </configure>
+ ... """)
+
+ >>> p = principalRegistry.unauthenticatedPrincipal()
+ >>> p.id, p.title, p.description
+ ('zope.unknown', u'Anonymous user', u"A person we don't know")
+
+The unauthenticated principal will also be registered as a utility.
+This is to provide easy access to the data defined for the principal so
+that other (more featureful) principal objects can be created for the
+same principal.
+
+ >>> from zope import component
+ >>> from zope.authentication import interfaces
+ >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
+ >>> p.id, p.title, p.description
+ ('zope.unknown', u'Anonymous user', u"A person we don't know")
+
+The unauthenticated group
+-------------------------
+
+An unauthenticated group can also be defined in ZCML:
+
+ >>> zcml("""
+ ... <configure
+ ... xmlns="http://namespaces.zope.org/zope"
+ ... >
+ ...
+ ... <unauthenticatedGroup
+ ... id="zope.unknowngroup"
+ ... title="Anonymous users"
+ ... description="People we don't know"
+ ... />
+ ...
+ ... </configure>
+ ... """)
+
+This directive creates a group and registers it as a utility providing
+IUnauthenticatedGroup:
+
+ >>> g = component.getUtility(interfaces.IUnauthenticatedGroup)
+ >>> g.id, g.title, g.description
+ ('zope.unknowngroup', u'Anonymous users', u"People we don't know")
+
+The unauthenticatedGroup directive also updates the group of the
+unauthenticated principal:
+
+ >>> p = principalRegistry.unauthenticatedPrincipal()
+ >>> g.id in p.groups
+ True
+ >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
+ >>> g.id in p.groups
+ True
+
+If the unauthenticated principal is defined after the unauthenticated
+group, it will likewise have the group added to it:
+
+ >>> reset()
+ >>> zcml("""
+ ... <configure
+ ... xmlns="http://namespaces.zope.org/zope"
+ ... >
+ ...
+ ... <unauthenticatedGroup
+ ... id="zope.unknowngroup2"
+ ... title="Anonymous users"
+ ... description="People we don't know"
+ ... />
+ ... <unauthenticatedPrincipal
+ ... id="zope.unknown2"
+ ... title="Anonymous user"
+ ... description="A person we don't know"
+ ... />
+ ...
+ ... </configure>
+ ... """)
+
+ >>> g = component.getUtility(interfaces.IUnauthenticatedGroup)
+ >>> g.id, g.title, g.description
+ ('zope.unknowngroup2', u'Anonymous users', u"People we don't know")
+ >>> p = principalRegistry.unauthenticatedPrincipal()
+ >>> p.id, g.id in p.groups
+ ('zope.unknown2', True)
+ >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
+ >>> p.id, g.id in p.groups
+ ('zope.unknown2', True)
+
+The unauthenticated group shows up as a principal in the principal
+registry:
+
+ >>> principalRegistry.getPrincipal(g.id) == g
+ True
+
+ >>> list(principalRegistry.getPrincipals("Anonymous")) == [g]
+ True
+
+The authenticated group
+-----------------------
+
+There is an authenticated group:
+
+ >>> reset()
+ >>> zcml("""
+ ... <configure
+ ... xmlns="http://namespaces.zope.org/zope"
+ ... >
+ ...
+ ... <unauthenticatedPrincipal
+ ... id="zope.unknown3"
+ ... title="Anonymous user"
+ ... description="A person we don't know"
+ ... />
+ ... <principal
+ ... id="zope.manager2"
+ ... title="Manager"
+ ... description="System Manager"
+ ... login="admin"
+ ... password="123"
+ ... />
+ ... <authenticatedGroup
+ ... id="zope.authenticated"
+ ... title="Authenticated users"
+ ... description="People we know"
+ ... />
+ ... <principal
+ ... id="zope.manager3"
+ ... title="Manager 3"
+ ... login="admin3"
+ ... password="123"
+ ... />
+ ...
+ ... </configure>
+ ... """)
+
+It defines an IAuthenticatedGroup utility:
+
+ >>> g = component.getUtility(interfaces.IAuthenticatedGroup)
+ >>> g.id, g.title, g.description
+ ('zope.authenticated', u'Authenticated users', u'People we know')
+
+It also adds it self to the groups of any non-group principals already
+defined, and, when non-group principals are defined, they put
+themselves in the group if it's defined:
+
+ >>> principals = list(principalRegistry.getPrincipals(''))
+ >>> principals.sort(lambda p1, p2: cmp(p1.id, p2.id))
+ >>> for p in principals:
+ ... print p.id, p.groups == [g.id]
+ zope.authenticated False
+ zope.manager2 True
+ zope.manager3 True
+
+Excluding unauthenticated principals, of course:
+
+ >>> p = principalRegistry.unauthenticatedPrincipal()
+ >>> p.id, g.id in p.groups
+ ('zope.unknown3', False)
+ >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
+ >>> p.id, g.id in p.groups
+ ('zope.unknown3', False)
+
+
+The everybody group
+-------------------
+
+Finally, there is an everybody group:
+
+ >>> reset()
+ >>> zcml("""
+ ... <configure
+ ... xmlns="http://namespaces.zope.org/zope"
+ ... >
+ ...
+ ... <unauthenticatedPrincipal
+ ... id="zope.unknown4"
+ ... title="Anonymous user"
+ ... description="A person we don't know"
+ ... />
+ ... <principal
+ ... id="zope.manager4"
+ ... title="Manager"
+ ... description="System Manager"
+ ... login="admin"
+ ... password="123"
+ ... />
+ ... <everybodyGroup
+ ... id="zope.everybody"
+ ... title="Everybody"
+ ... description="All People"
+ ... />
+ ... <principal
+ ... id="zope.manager5"
+ ... title="Manager 5"
+ ... login="admin5"
+ ... password="123"
+ ... />
+ ...
+ ... </configure>
+ ... """)
+
+The everybodyGroup directive defines an IEveryoneGroup utility:
+
+ >>> g = component.getUtility(interfaces.IEveryoneGroup)
+ >>> g.id, g.title, g.description
+ ('zope.everybody', u'Everybody', u'All People')
+
+It also adds it self to the groups of any non-group principals already
+defined, and, when non-group principals are defined, they put
+themselves in the group if it's defined:
+
+ >>> principals = list(principalRegistry.getPrincipals(''))
+ >>> principals.sort(lambda p1, p2: cmp(p1.id, p2.id))
+ >>> for p in principals:
+ ... print p.id, p.groups == [g.id]
+ zope.everybody False
+ zope.manager4 True
+ zope.manager5 True
+
+Including unauthenticated principals, of course:
+
+ >>> p = principalRegistry.unauthenticatedPrincipal()
+ >>> p.id, g.id in p.groups
+ ('zope.unknown4', True)
+ >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
+ >>> p.id, g.id in p.groups
+ ('zope.unknown4', True)
+
+Note that it is up to IAuthentication implementations to associate
+these groups with their principals, as appropriate.
+
+
+The system_user
+---------------
+
+There is also a system_user that is defined in the code. It will be returned
+from the getPrincipal method of the registry.
+
+ >>> import zope.security.management
+ >>> import zope.principalregistry.principalregistry
+ >>> auth = zope.principalregistry.principalregistry.PrincipalRegistry()
+ >>> system_user = auth.getPrincipal(u'zope.security.management.system_user')
+ >>> system_user is zope.security.management.system_user
+ True
Modified: zope.principalregistry/trunk/src/zope/principalregistry/__init__.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/__init__.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/__init__.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,24 +1 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Zope Application-specific Security code
-
-$Id$
-"""
-# Register some standard types
-import _protections
-_protections.protect()
-del _protections
-
-# BBB: the code was moved to zope.authentication
-from zope.authentication.logout import LogoutSupported, NoLogout
+# i am a package
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/_protections.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/_protections.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/_protections.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,35 +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
-#
-##############################################################################
-"""Register protection information for some standard low-level types
-
-$Id$
-"""
-
-def protect():
- # Add message id types to the basic types, so their setting cannot be
- # overridden, once set. `protect()` was not guranteed to run after
- # zope.security.checker._clear, so that sometimes the proxies were not set.
- # This is not the ideal solution, but it is effective.
-
- # Make sure the message id gets never proxied. This is not a
- # security hole because Messages are immutable.
- import zope.security.checker
- from zope.security.checker import NoProxy
- from zope.i18nmessageid import Message
- zope.security.checker.BasicTypes[Message] = NoProxy
-
- # add __parent__ and __name__ to always available names
- for name in ['__name__', '__parent__']:
- if name not in zope.security.checker._available_by_default:
- zope.security.checker._available_by_default.append(name)
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/_protections.zcml
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/_protections.zcml 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/_protections.zcml 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,126 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- i18n_domain="zope"
- >
-
-<!-- ===================================================================== -->
-
-<class class="BTrees.IIBTree.IIBTree">
- <allow attributes="__str__ __contains__ __getitem__ __iter__ __len__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKey minKey values" />
-</class>
-<class class="BTrees.IIBTree.IIBucket">
- <allow attributes="__contains__ __getitem__ __iter__ __len__ __str__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKeyminKey values" />
-</class>
-<class class="BTrees.IIBTree.IISet">
- <allow attributes="__contains__ __iter__ __len__ __str__ has_key insert
- keys maxKey minKey" />
-</class>
-<class class="BTrees.IIBTree.IITreeIterator">
- <allow attributes="__iter__ __str__ __getitem__ __len__
- __contains__ next" />
-</class>
-
-<!-- ===================================================================== -->
-
-<class class="BTrees.IOBTree.IOBTree">
- <allow attributes="__str__ __contains__ __getitem__ __iter__ __len__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKey minKey values" />
-</class>
-<class class="BTrees.IOBTree.IOBucket">
- <allow attributes="__contains__ __getitem__ __iter__ __len__ __str__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKeyminKey values" />
-</class>
-<class class="BTrees.IOBTree.IOSet">
- <allow attributes="__contains__ __iter__ __len__ __str__ has_key insert
- keys maxKey minKey" />
-</class>
-<class class="BTrees.IOBTree.IOTreeIterator">
- <allow attributes="__iter__ __str__ __getitem__ __len__
- __contains__ next" />
-</class>
-
-<!-- ===================================================================== -->
-
-<class class="BTrees.OIBTree.OIBTree">
- <allow attributes="__str__ __contains__ __getitem__ __iter__ __len__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKey minKey values" />
-</class>
-<class class="BTrees.OIBTree.OIBucket">
- <allow attributes="__contains__ __getitem__ __iter__ __len__ __str__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKeyminKey values" />
-</class>
-<class class="BTrees.OIBTree.OISet">
- <allow attributes="__contains__ __iter__ __len__ __str__ has_key insert
- keys maxKey minKey" />
-</class>
-<class class="BTrees.OIBTree.OITreeIterator">
- <allow attributes="__iter__ __str__ __getitem__ __len__
- __contains__ next" />
-</class>
-
-<!-- ===================================================================== -->
-
-<class class="BTrees.OOBTree.OOBTree">
- <allow attributes="__str__ __contains__ __getitem__ __iter__ __len__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKey minKey values" />
-</class>
-<class class="BTrees.OOBTree.OOBucket">
- <allow attributes="__contains__ __getitem__ __iter__ __len__ __str__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKeyminKey values" />
-</class>
-<class class="BTrees.OOBTree.OOSet">
- <allow attributes="__contains__ __iter__ __len__ __str__ has_key insert
- keys maxKey minKey" />
-</class>
-<class class="BTrees.OOBTree.OOTreeIterator">
- <allow attributes="__iter__ __str__ __getitem__ __len__
- __contains__ next" />
-</class>
-
-<!-- ===================================================================== -->
-
-<class class="BTrees.IFBTree.IFBTree">
- <allow attributes="__str__ __contains__ __getitem__ __iter__ __len__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKey minKey values" />
-</class>
-<class class="BTrees.IFBTree.IFBucket">
- <allow attributes="__contains__ __getitem__ __iter__ __len__ __str__
- byValue get has_key items iteritems iterkeys
- itervalues keys maxKeyminKey values" />
-</class>
-<class class="BTrees.IFBTree.IFSet">
- <allow attributes="__contains__ __iter__ __len__ __str__ has_key insert
- keys maxKey minKey" />
-</class>
-<class class="BTrees.IFBTree.IFTreeIterator">
- <allow attributes="__iter__ __str__ __getitem__ __len__
- __contains__ next" />
-</class>
-
-<!-- ===================================================================== -->
-
-<class class="persistent.list.PersistentList">
- <allow attributes="__getitem__ __getslice__ __len__ __iter__
- __contains__ index count" />
-</class>
-<class class="persistent.dict.PersistentDict">
- <allow attributes="__getitem__ __len__ __iter__ get has_key
- __copy__ keys values items iterkeys iteritems
- itervalues __contains__" />
-</class>
-
-<!-- ===================================================================== -->
-
-</configure>
-
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/basicauthadapter.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/basicauthadapter.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/basicauthadapter.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,20 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 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.
-#
-##############################################################################
-"""Backward compatibility for the IHTTPCredentials -> ILoginPassword adapter
-
-$Id$
-"""
-
-# BBB, XXX: this may change in near future
-from zope.authentication.basicauthadapter import BasicAuthAdapter
Modified: zope.principalregistry/trunk/src/zope/principalregistry/configure.zcml
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/configure.zcml 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/configure.zcml 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,79 +1,17 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- i18n_domain="zope"
- >
+<configure xmlns="http://namespaces.zope.org/zope">
- <include package="zope.security" />
- <include package="zope.localpermission" />
- <include package="zope.authentication" />
-
- <include file="globalmodules.zcml" />
- <include file="_protections.zcml" />
-
<utility
- provides=".interfaces.IAuthentication"
+ provides="zope.authentication.interfaces.IAuthentication"
component=".principalregistry.principalRegistry"
/>
- <class class=".principalregistry.Principal">
- <allow
- interface=".interfaces.IPrincipal"
- />
- </class>
-
- <!-- Standard Permissions -->
-
- <permission
- id="zope.View"
- title="[view-permission] View"
- />
-
- <permission
- id="zope.Security"
- title="[change-security-settings-permission] Change security settings"
- />
-
- <permission
- id="zope.ManageContent"
- title="[manage-content-permission] Manage Content"
- />
-
- <permission
- id="zope.ManageBindings"
- title="[manage-service-bindings-permission] Manage Service Bindings"
- />
-
- <permission
- id="zope.ManageCode"
- title="[manage-code-permission] Manage Code"
- description="Manage executable code, including Python, SQL, ZPT, etc."
- />
-
- <permission
- id="zope.ManageServices"
- title="[manage-services-permission] Manage Services"
- />
-
- <permission
- id="zope.ManageSite"
- title="[manage-site-permission] Manage Site"
- />
-
- <permission
- id="zope.ManagePrincipals"
- title="[manage-principal-permission] Manage Principals"
- />
-
- <permission
- id="zope.ManageApplication"
- title="[manage-application-permission] Manage Application"
- description="Manage the Zope Application, such as Restart/Shutdown or
- packing the ZODB."
- />
-
<utility
component=".principalregistry.fallback_unauthenticated_principal"
- provides=".interfaces.IFallbackUnauthenticatedPrincipal"
+ provides="zope.authentication.interfaces.IFallbackUnauthenticatedPrincipal"
/>
+ <class class=".principalregistry.Principal">
+ <allow interface="zope.security.interfaces.IPrincipal" />
+ </class>
+
</configure>
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/ftpauth.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/ftpauth.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/ftpauth.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,20 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 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.
-#
-##############################################################################
-"""Backward compatibility for the IFTPCredentials -> ILoginPassword adapter
-
-$Id$
-"""
-
-# BBB, XXX: this may change in near future
-from zope.authentication.ftpauth import FTPAuth
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/globalmodules.zcml
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/globalmodules.zcml 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/globalmodules.zcml 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,434 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:zcml="http://namespaces.zope.org/zcml">
-
- <!-- 4. String Services -->
-
- <module module="string">
- <allow attributes="ascii_letters ascii_lowercase ascii_uppercase digits
- hexdigits letters lowercase octdigits punctuation
- printable uppercase whitespace atof atoi capitalize
- capwords expandtabs find rfind index rindex count lower
- maketrans split splitfields join joinfields lstrip
- rstrip strip swapcase translate upper ljust rjust
- center zfill replace" />
- </module>
-
- <module module="re">
- <allow attributes="compile I IGNORECASE L LOCALE M MULTILINE S DOTALL U
- UNICODE X VERBOSE search match split findall finditer
- sub subn" />
- </module>
-
- <module module="struct">
- <allow attributes="pack unpack calcsize" />
- </module>
-
- <module module="difflib">
- <allow attributes="SequenceMatcher Differ context_diff get_close_matches
- ndiff restore unified_diff" />
- </module>
-
- <module module="fpformat">
- <allow attributes="fix sci NotANumber" />
- </module>
-
- <module module="StringIO">
- <allow attributes="StringIO" />
- </module>
-
- <module module="cStringIO">
- <allow attributes="StringIO InputType OutputType" />
- </module>
-
- <module module="textwrap">
- <allow attributes="wrap fill dedent TextWrapper" />
- </module>
-
- <module module="codecs">
- <allow attributes="lookup getencoder getdecoder getreader
- getwriter lookup_error BOM BOM_BE BOM_LE BOM_UTF8
- BOM_UTF16 BOM_UTF16_BE BOM_UTF16_LE BOM_UTF32
- BOM_UTF32_BE BOM_UTF32_LE" />
- </module>
-
- <module module="unicodedata">
- <allow attributes="lookup name decimal digit numeric category
- bidirectional combining mirrored decomposition
- normalize unidata_version" />
- </module>
-
- <module module="stringprep">
- <allow attributes="in_table_a1 in_table_b1 map_table_b2 map_table_b3
- in_table_c11 in_table_c12 in_table_c11_c12 in_table_c21
- in_table_c22 in_table_c21_c22 in_table_c3 in_table_c4
- in_table_c5 in_table_c6 in_table_c7 in_table_c8
- in_table_c9 in_table_d1 in_table_d2" />
- </module>
-
- <!-- 5. Miscellaneous Services -->
-
- <module module="unittest">
- <allow attributes="TestCase FunctionTestCase TestSuite TestLoader
- defaultTestLoader TextTestRunner main" />
- </module>
-
- <module module="decimal">
- <allow attributes="Decimal Context DefaultContext BasicContext
- ExtendedContext DecimalException Clamped
- InvalidOperation DivisionByZero Inexact Rounded
- Subnormal Overflow Underflow ROUND_DOWN ROUND_HALF_UP
- ROUND_HALF_EVEN ROUND_CEILING ROUND_FLOOR ROUND_UP
- ROUND_HALF_DOWN setcontext getcontext" />
- </module>
-
- <module module="math">
- <allow attributes="acos asin atan atan2 ceil cos cosh degress exp fabs
- floor fmod frexp hypot ldexp log log10 modf pow radians
- sin sinh sqrt tan tanh pi e" />
- </module>
-
- <module module="cmath">
- <allow attributes="acos acosh asin asinh atan atanh cos cosh exp log log10
- sin sinh sqrt tan tanh pi e" />
- </module>
-
- <module module="random">
- <allow attributes="seed getstate setstate jumpahead randrange randint
- choice shuffle sample random uniform betavariate
- expovariate gammavariate gauss lognormvariate
- normalvariate vormisesvariate paretovariate
- weibullvariate WichmannHill whseed" />
- </module>
-
- <module module="bisect">
- <allow attributes="bisect_left bisect_right bisect insort_left
- insort_right insort" />
- </module>
-
- <module module="heapq">
- <allow attributes="heappush heappop heapify heapreplace" />
- </module>
-
- <module module="array">
- <allow attributes="array ArrayType" />
- </module>
-
- <module module="sets">
- <allow attributes="Set ImmutableSet" />
- </module>
-
- <module module="itertools">
- <allow attributes="chain count cycle dropwhile iffilter iffilterfalse imap
- islice izip repeat starmap takewhile" />
- </module>
-
- <module module="ConfigParser">
- <allow attributes="RawConfigParser ConfigParser SafeConfigParser
- NoSectionError DuplicateSectionError NoOptionError
- InterpolationError InterpolationDepthError
- InterpolationMissingOptionError
- InterpolationSyntaxError MissingSectionHeaderError
- ParsingError MAX_INTERPOLATION_DEPTH" />
- </module>
-
- <module module="calendar">
- <allow attributes="MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY
- SUNDAY setfirstweekday firstweekday isleap leapdays
- weekday monthrange monthcalendar prmonth month prcal
- calendar timegm" />
- </module>
-
- <module module="cmd">
- <allow attributes="Cmd" />
- </module>
-
- <module module="shlex">
- <allow attributes="split shlex" />
- </module>
-
- <!-- 6. Generic Operating System Services -->
-
- <module module="os.path">
- <allow attributes="abspath basename commonprefix dirname isabs join
- normcase normpath split splitdrive splitext" />
- </module>
-
- <module module="datetime">
- <allow attributes="MINYEAR MAXYEAR date time datetime timedelta tzinfo" />
- </module>
-
- <module module="time">
- <allow attributes="acceot2dyear altzone asctime clock ctime daylight
- gmtime localtime mktime sleep strftime" />
- </module>
-
- <module module="sched">
- <allow attributes="scheduler" />
- </module>
-
- <module module="getopt">
- <allow attributes="getopt gnu_getopt GetoptError error" />
- </module>
-
- <module module="optparse">
- <allow attributes="OptionParser" />
- </module>
-
- <module module="fnmatch">
- <allow attributes="fnmatch fnmatchcase filter" />
- </module>
-
- <module module="gettext">
- <allow attributes="bindtextdomain textdomain gettext dgettext ngettext
- dngettext " />
- </module>
-
-
- <!-- 11. Internet Protocols and Support -->
-
- <module module="cgi">
- <allow attributes="parse parse_qs parse_qsl parse_multipart parse_header
- escape" />
- </module>
-
- <module module="urllib">
- <allow attributes="urlopen urlretrieve _urlopener urlcleanup quote
- quote_plus unquote unquote_plus urlencode pathname2url
- url2pathname URLopener FancyURLopener" />
- </module>
-
- <module module="urllib2">
- <allow attributes="urlopen install_opener build_opener URLError HTTPError
- GopherError Request OpenerDirector BaseHandler
- HTTPDefaultErrorHandler HTTPRedirectHandler
- ProxyHandler HTTPPasswordMgr
- HTTPPasswordMgrWithDefaultRealm
- AbstractBasicAuthHandler HTTPBasicAuthHandler
- ProxyBasicAuthHandler AbstractDigestAuthHandler
- HTTPDigestAuthHandler ProxyDigestAuthHandler
- HTTPHandler HTTPSHandler FileHandler FTPHandler
- CacheFTPHandler GopherHAndler UnknownHandler" />
- </module>
-
- <module module="httplib">
- <allow attributes="HTTP_PORT HTTPS_PORT HTTPConnection HTTPSConnection
- HTTPResponse HTTPException NotConnected InvalidURL
- UnknownProtocol UnknownTransferEncoding
- UnimplementedFileMode IncompleteRead
- ImproperConnectionState CannotSendRequest
- CannotSendHeader ResponseNotReady BadStatusLine" />
- </module>
-
- <module module="ftplib">
- <allow attributes="FTP all_errors error_reply error_temp error_perm
- error_proto" />
- </module>
-
- <!-- This package has been deprecated in Python 2.5; let's use a cheap way
- of detecting Python 2.4 by checking whether the package "hashlib" is
- not available, which has been added only in Python 2.5. -->
- <module module="gopherlib"
- zcml:condition="not-installed hashlib">
- <allow attributes="send_selection send_query" />
- </module>
-
- <module module="poplib">
- <allow attributes="POP3 error_proto" />
- </module>
-
- <module module="imaplib">
- <allow attributes="IMAP4" />
- </module>
-
- <module module="nntplib">
- <allow attributes="NNTP NNTPError NNTPReplyError NNTPTemporaryError
- NNTPPermanentError NNTPProtocolError NNTPDataError" />
- </module>
-
- <module module="smtplib">
- <allow attributes="SMTP SMTPException SMTPServerDisconnected
- SMTPResponseException SMTPSenderRefused
- SMTPRecipientsRefused SMTPDataError SMTPConnectError
- SMTPHeloError" />
- </module>
-
- <module module="telnetlib">
- <allow attributes="Telnet" />
- </module>
-
- <module module="urlparse">
- <allow attributes="urlparse urlunparse urlsplit urlunsplit urljoin
- urldefrag" />
- </module>
-
- <module module="Cookie">
- <allow attributes="CookieError BaseCookie SimpleCookie" />
- </module>
-
- <module module="xmlrpclib">
- <allow attributes="ServerProxy boolean binary" />
- </module>
-
- <!-- 12. Internet Data Handling -->
-
- <module module="formatter">
- <allow attributes="AS_IS AbstractFormatter AbstractWriter DumbWriter
- NullFormatter NullWriter" />
- </module>
-
- <module module="email">
- <allow attributes="message_from_file message_from_string" />
- </module>
-
- <module module="mailcap">
- <allow attributes="findmatch getcaps" />
- </module>
-
- <module module="mailbox">
- <allow attributes="UnixMailbox PortableUnixMailbox MmdfMailbox MHMailbox
- Maildir BabylMailbox" />
- </module>
-
- <module module="mhlib">
- <allow attributes="MH Folder Message" />
- </module>
-
- <module module="mimetypes">
- <allow attributes="guess_type guess_all_extensions guess_extension" />
- </module>
-
- <module module="multifile">
- <allow attributes="MultiFile" />
- </module>
-
- <module module="rfc822">
- <allow attributes="Message AddressList quote unquote parseaddr
- dump_address_pair parsedate parsedate_tz mktime_tz" />
- </module>
-
- <module module="base64">
- <allow attributes="decode decodestring encode encodestring" />
- </module>
-
- <module module="binascii">
- <allow attributes="a2b_uu b2a_uu a2b_base64 b2a_base64 a2b_qp b2a_qp
- a2b_hqx rledecode_hqx rlecode_hqx b2a_hqx crc_hqx
- crc32 b2a_hex hexlify a2b_hex unhexlify Error
- Incomplete" />
- </module>
-
- <module module="binhex">
- <allow attributes="binhex hexbin Error" />
- </module>
-
- <module module="quopri">
- <allow attributes="decode encode decodestring encodestring" />
- </module>
-
- <module module="uu">
- <allow attributes="encode decode Error" />
- </module>
-
- <module module="xdrlib">
- <allow attributes="Packer Unpacker" />
- </module>
-
- <module module="netrc">
- <allow attributes="netrc NetrcParseError" />
- </module>
-
- <module module="robotparser">
- <allow attributes="RobotFileParser" />
- </module>
-
- <module module="csv">
- <allow attributes="reader writer register_dialect unregister_dialect
- list_dialects DictReader DictWriter Dialect Sniffer
- sniff has_header QUOTE_ALL QUOTE_MINIMAL
- QUOTE_NONNUMERIC QUOTE_NONE Error" />
- </module>
-
- <!-- 13. Structured Markup Processing Tools -->
-
- <module module="HTMLParser">
- <allow attributes="HTMLParser" />
- </module>
-
- <module module="sgmllib">
- <allow attributes="SGMLParser" />
- </module>
-
- <module module="htmllib">
- <allow attributes="HTMLParser" />
- </module>
-
- <module module="htmlentitydefs">
- <allow attributes="entitydefs name2codepoint codepoint2name" />
- </module>
-
- <module module="xml.parsers.expat">
- <allow attributes="ExpatError error XMLParserType ErrorString
- ParserCreate" />
- </module>
-
- <module module="xml.dom">
- <allow attributes="registerDOMImplementation getDOMImplementation
- EMPTY_NAMESPACE XML_NAMESPACE XMLNS_NAMESPACE
- XHTML_NAMESPACE" />
- </module>
-
- <module module="xml.dom.minidom">
- <allow attributes="parse parseString" />
- </module>
-
- <module module="xml.dom.pulldom">
- <allow attributes="PullDOM DOMEventStrem SAX2DOM parse parseString
- default_bufsize" />
- </module>
-
- <module module="xml.sax">
- <allow attributes="make_parser parse parseString SAXException
- SAXParseException SAXNotRecognizedException
- SAXNotSupprotedException" />
- </module>
-
- <module module="xml.sax.handler">
- <allow attributes="ContentHandler DTDHandler EntityResolver ErrorHandler
- feature_namespaces feature_namespace_prefixes
- feature_string_interning feature_validation
- feature_external_ges feature_external_pes all_features
- property_lexical_handler property_declaration_handler
- property_dom_node property_xml_string all_properties" />
- </module>
-
- <module module="xml.sax.saxutils">
- <allow attributes="escape unescape quoteattr XMLGenerator XMLFilterBase
- prepare_input_source" />
- </module>
-
- <module module="xml.sax.xmlreader">
- <allow attributes="XMLReader IncrementalParser Locator InputSource
- AttributesImpl AttributesNSImpl" />
- </module>
-
- <!-- 15. Cryptographic Services -->
-
- <module module="hmac">
- <allow attributes="new" />
- </module>
-
- <!-- These packages has been deprecated in Python 2.6 in favor of hashlib;
- let's use a cheap way of detecting Python<=2.5 by checking whether the
- package "json" is not available, which has been added only in Python 2.6. -->
- <module module="md5"
- zcml:condition="not-installed json">
- <allow attributes="new digest_size" />
- </module>
-
- <module module="sha"
- zcml:condition="not-installed json">
- <allow attributes="new blocksize digest_size" />
- </module>
-
-</configure>
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/globalprincipals.txt
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/globalprincipals.txt 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/globalprincipals.txt 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,294 +0,0 @@
-===========================
-Global principal definition
-===========================
-
-Global principals are defined via ZCML. There are several kinds of
-principals that can be defined.
-
-Authenticated Users
--------------------
-
-There are principals that can log in:
-
- >>> zcml("""
- ... <configure
- ... xmlns="http://namespaces.zope.org/zope"
- ... >
- ...
- ... <principal
- ... id="zope.manager"
- ... title="Manager"
- ... description="System Manager"
- ... login="admin"
- ... password_manager="SHA1"
- ... password="40bd001563085fc35165329ea1ff5c5ecbdbbeef"
- ... />
- ...
- ... </configure>
- ... """)
-
- >>> import pprint
- >>> from zope.app.security.principalregistry import principalRegistry
- >>> [p] = principalRegistry.getPrincipals('')
- >>> p.id, p.title, p.description, p.getLogin(), p.validate('123')
- ('zope.manager', u'Manager', u'System Manager', u'admin', True)
-
-The unauthenticated principal
------------------------------
-
-There is the unauthenticated principal:
-
- >>> zcml("""
- ... <configure
- ... xmlns="http://namespaces.zope.org/zope"
- ... >
- ...
- ... <unauthenticatedPrincipal
- ... id="zope.unknown"
- ... title="Anonymous user"
- ... description="A person we don't know"
- ... />
- ...
- ... </configure>
- ... """)
-
- >>> p = principalRegistry.unauthenticatedPrincipal()
- >>> p.id, p.title, p.description
- ('zope.unknown', u'Anonymous user', u"A person we don't know")
-
-The unauthenticated principal will also be registered as a utility.
-This is to provide easy access to the data defined for the principal so
-that other (more featureful) principal objects can be created for the
-same principal.
-
- >>> from zope import component
- >>> from zope.app.security import interfaces
- >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
- >>> p.id, p.title, p.description
- ('zope.unknown', u'Anonymous user', u"A person we don't know")
-
-The unauthenticated group
--------------------------
-
-An unauthenticated group can also be defined in ZCML:
-
- >>> zcml("""
- ... <configure
- ... xmlns="http://namespaces.zope.org/zope"
- ... >
- ...
- ... <unauthenticatedGroup
- ... id="zope.unknowngroup"
- ... title="Anonymous users"
- ... description="People we don't know"
- ... />
- ...
- ... </configure>
- ... """)
-
-This directive creates a group and registers it as a utility providing
-IUnauthenticatedGroup:
-
- >>> g = component.getUtility(interfaces.IUnauthenticatedGroup)
- >>> g.id, g.title, g.description
- ('zope.unknowngroup', u'Anonymous users', u"People we don't know")
-
-The unauthenticatedGroup directive also updates the group of the
-unauthenticated principal:
-
- >>> p = principalRegistry.unauthenticatedPrincipal()
- >>> g.id in p.groups
- True
- >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
- >>> g.id in p.groups
- True
-
-If the unauthenticated principal is defined after the unauthenticated
-group, it will likewise have the group added to it:
-
- >>> reset()
- >>> zcml("""
- ... <configure
- ... xmlns="http://namespaces.zope.org/zope"
- ... >
- ...
- ... <unauthenticatedGroup
- ... id="zope.unknowngroup2"
- ... title="Anonymous users"
- ... description="People we don't know"
- ... />
- ... <unauthenticatedPrincipal
- ... id="zope.unknown2"
- ... title="Anonymous user"
- ... description="A person we don't know"
- ... />
- ...
- ... </configure>
- ... """)
-
- >>> g = component.getUtility(interfaces.IUnauthenticatedGroup)
- >>> g.id, g.title, g.description
- ('zope.unknowngroup2', u'Anonymous users', u"People we don't know")
- >>> p = principalRegistry.unauthenticatedPrincipal()
- >>> p.id, g.id in p.groups
- ('zope.unknown2', True)
- >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
- >>> p.id, g.id in p.groups
- ('zope.unknown2', True)
-
-The unauthenticated group shows up as a principal in the principal
-registry:
-
- >>> principalRegistry.getPrincipal(g.id) == g
- True
-
- >>> list(principalRegistry.getPrincipals("Anonymous")) == [g]
- True
-
-The authenticated group
------------------------
-
-There is an authenticated group:
-
- >>> reset()
- >>> zcml("""
- ... <configure
- ... xmlns="http://namespaces.zope.org/zope"
- ... >
- ...
- ... <unauthenticatedPrincipal
- ... id="zope.unknown3"
- ... title="Anonymous user"
- ... description="A person we don't know"
- ... />
- ... <principal
- ... id="zope.manager2"
- ... title="Manager"
- ... description="System Manager"
- ... login="admin"
- ... password="123"
- ... />
- ... <authenticatedGroup
- ... id="zope.authenticated"
- ... title="Authenticated users"
- ... description="People we know"
- ... />
- ... <principal
- ... id="zope.manager3"
- ... title="Manager 3"
- ... login="admin3"
- ... password="123"
- ... />
- ...
- ... </configure>
- ... """)
-
-It defines an IAuthenticatedGroup utility:
-
- >>> g = component.getUtility(interfaces.IAuthenticatedGroup)
- >>> g.id, g.title, g.description
- ('zope.authenticated', u'Authenticated users', u'People we know')
-
-It also adds it self to the groups of any non-group principals already
-defined, and, when non-group principals are defined, they put
-themselves in the group if it's defined:
-
- >>> principals = list(principalRegistry.getPrincipals(''))
- >>> principals.sort(lambda p1, p2: cmp(p1.id, p2.id))
- >>> for p in principals:
- ... print p.id, p.groups == [g.id]
- zope.authenticated False
- zope.manager2 True
- zope.manager3 True
-
-Excluding unauthenticated principals, of course:
-
- >>> p = principalRegistry.unauthenticatedPrincipal()
- >>> p.id, g.id in p.groups
- ('zope.unknown3', False)
- >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
- >>> p.id, g.id in p.groups
- ('zope.unknown3', False)
-
-
-The everybody group
--------------------
-
-Finally, there is an everybody group:
-
- >>> reset()
- >>> zcml("""
- ... <configure
- ... xmlns="http://namespaces.zope.org/zope"
- ... >
- ...
- ... <unauthenticatedPrincipal
- ... id="zope.unknown4"
- ... title="Anonymous user"
- ... description="A person we don't know"
- ... />
- ... <principal
- ... id="zope.manager4"
- ... title="Manager"
- ... description="System Manager"
- ... login="admin"
- ... password="123"
- ... />
- ... <everybodyGroup
- ... id="zope.everybody"
- ... title="Everybody"
- ... description="All People"
- ... />
- ... <principal
- ... id="zope.manager5"
- ... title="Manager 5"
- ... login="admin5"
- ... password="123"
- ... />
- ...
- ... </configure>
- ... """)
-
-The everybodyGroup directive defines an IEveryoneGroup utility:
-
- >>> g = component.getUtility(interfaces.IEveryoneGroup)
- >>> g.id, g.title, g.description
- ('zope.everybody', u'Everybody', u'All People')
-
-It also adds it self to the groups of any non-group principals already
-defined, and, when non-group principals are defined, they put
-themselves in the group if it's defined:
-
- >>> principals = list(principalRegistry.getPrincipals(''))
- >>> principals.sort(lambda p1, p2: cmp(p1.id, p2.id))
- >>> for p in principals:
- ... print p.id, p.groups == [g.id]
- zope.everybody False
- zope.manager4 True
- zope.manager5 True
-
-Including unauthenticated principals, of course:
-
- >>> p = principalRegistry.unauthenticatedPrincipal()
- >>> p.id, g.id in p.groups
- ('zope.unknown4', True)
- >>> p = component.getUtility(interfaces.IUnauthenticatedPrincipal)
- >>> p.id, g.id in p.groups
- ('zope.unknown4', True)
-
-Note that it is up to IAuthentication implementations to associate
-these groups with their principals, as appropriate.
-
-
-The system_user
----------------
-
-There is also a system_user that is defined in the code. It will be returned
-from the getPrincipal method of the registry.
-
- >>> import zope.security.management
- >>> import zope.app.security.principalregistry
- >>> auth = zope.app.security.principalregistry.PrincipalRegistry()
- >>> system_user = auth.getPrincipal(u'zope.security.management.system_user')
- >>> system_user is zope.security.management.system_user
- True
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/i18n.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/i18n.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/i18n.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,17 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 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.
-#
-##############################################################################
-
-import zope.i18nmessageid
-
-_ = zope.i18nmessageid.MessageFactory("zope")
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/interfaces.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/interfaces.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/interfaces.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,33 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 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.
-#
-##############################################################################
-"""Backward-compatibility imports for authentication interfaces
-
-$Id$
-"""
-
-# BBB
-from zope.security.interfaces import IPrincipal, IPermission, IGroup
-from zope.authentication.interfaces import (
- PrincipalLookupError,
- IUnauthenticatedPrincipal,
- IFallbackUnauthenticatedPrincipal,
- IUnauthenticatedGroup,
- IAuthenticatedGroup,
- IEveryoneGroup,
- IAuthentication,
- ILoginPassword,
- IPrincipalSource,
- ILogout,
- ILogoutSupported,
- )
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/loginpassword.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/loginpassword.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/loginpassword.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,20 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 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.
-#
-##############################################################################
-"""Backward-compatibility import for base ILoginPassword implementation.
-
-$Id$
-"""
-
-# BBB
-from zope.authentication.loginpassword import LoginPassword
Modified: zope.principalregistry/trunk/src/zope/principalregistry/meta.zcml
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/meta.zcml 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/meta.zcml 2009-03-12 02:11:13 UTC (rev 97946)
@@ -2,8 +2,6 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta">
- <include package="zope.security" file="meta.zcml" />
-
<meta:directive
namespace="http://namespaces.zope.org/zope"
name="principal"
Modified: zope.principalregistry/trunk/src/zope/principalregistry/metaconfigure.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/metaconfigure.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/metaconfigure.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -17,9 +17,9 @@
"""
from zope import component
from zope.component.zcml import utility
+from zope.authentication import interfaces
-from zope.app.security import principalregistry
-from zope.app.security import interfaces
+from zope.principalregistry import principalregistry
def _principal():
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/permission.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/permission.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/permission.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,26 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 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.
-#
-##############################################################################
-"""Backward compatibility imports for zope.localpermission.
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-# BBB: the functionality was moved to zope.localpermission
-from zope.localpermission.permission import (
- NULL_ID,
- LocalPermission,
- setIdOnActivation,
- unsetIdOnDeactivation,
- )
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/principal.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/principal.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/principal.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,20 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 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.
-#
-##############################################################################
-"""Backward-compatibility import for the checkPrincipal function
-
-$Id$
-"""
-
-# BBB
-from zope.authentication.principal import checkPrincipal
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/principallogging.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/principallogging.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/principallogging.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,20 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 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.
-#
-##############################################################################
-"""Backward-compatibility import for PrincipalLogging
-
-$Id$
-"""
-
-# BBB: this was moved to zope.publisher.
-from zope.publisher.principallogging import PrincipalLogging
Modified: zope.principalregistry/trunk/src/zope/principalregistry/principalregistry.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/principalregistry.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/principalregistry.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -17,29 +17,41 @@
"""
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
+# XXX: THIS IS BAD
+from zope.container.contained import Contained, contained
+from zope.authentication.interfaces import (
+ IAuthentication,
+ PrincipalLookupError,
+ ILoginPassword,
+ ILogout,
+ IUnauthenticatedPrincipal,
+ IUnauthenticatedGroup,
+ IAuthenticatedGroup,
+ IEveryoneGroup,
+ )
+
class DuplicateLogin(Exception):
pass
+
class DuplicateId(Exception):
pass
+
class PrincipalRegistry(object):
- implements(interfaces.IAuthentication, interfaces.ILogout)
+ implements(IAuthentication, ILogout)
# Methods implementing IAuthentication
def authenticate(self, request):
- a = interfaces.ILoginPassword(request, None)
+ a = ILoginPassword(request, None)
if a is not None:
login = a.getLogin()
if login is not None:
@@ -68,7 +80,7 @@
def unauthorized(self, id, request):
if id is None or id is self.__defaultid:
- a = interfaces.ILoginPassword(request)
+ a = ILoginPassword(request)
a.needLogin(realm="Zope")
def getPrincipal(self, id):
@@ -78,7 +90,7 @@
return self.__defaultObject
if id == zope.security.management.system_user.id:
return zope.security.management.system_user
- raise interfaces.PrincipalLookupError(id)
+ raise PrincipalLookupError(id)
return r
def getPrincipalByLogin(self, login):
@@ -179,7 +191,7 @@
class UnauthenticatedPrincipal(PrincipalBase):
- implements(interfaces.IUnauthenticatedPrincipal)
+ implements(IUnauthenticatedPrincipal)
fallback_unauthenticated_principal = (
@@ -193,12 +205,12 @@
class UnauthenticatedGroup(Group):
- implements(interfaces.IUnauthenticatedGroup)
+ implements(IUnauthenticatedGroup)
class AuthenticatedGroup(Group):
- implements(interfaces.IAuthenticatedGroup)
+ implements(IAuthenticatedGroup)
class EverybodyGroup(Group):
- implements(interfaces.IEveryoneGroup)
+ implements(IEveryoneGroup)
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/protectclass.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/protectclass.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/protectclass.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,23 +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.
-#
-##############################################################################
-"""Backward compatibility: code was moved to zope.security.protectclass.
-
-$Id$
-"""
-from zope.security.checker import defineChecker, getCheckerForInstancesOf
-from zope.security.checker import Checker, CheckerPublic
-
-from zope.security.protectclass import (protectName,
- protectSetAttribute,
- protectLikeUnto)
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/settings.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/settings.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/settings.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,28 +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.
-#
-##############################################################################
-"""Backward-compatibility import for security policy constants to allow
-unpickling of old pickled security settings.
-
-$Id$
-"""
-try:
- from zope.securitypolicy.settings import Allow, Deny, Unset
-except ImportError:
- import logging
- logging.error('Allow, Unset and Deny constants are now '
- 'moved from zope.app.security.settings to '
- 'zope.securitypolicy.settings and you don\'t '
- 'seem to have it installed. This is very rare '
- 'case and you should manually install '
- 'the ``zope.securitypolicy`` package.')
Modified: zope.principalregistry/trunk/src/zope/principalregistry/tests/__init__.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/__init__.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/__init__.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,33 +1 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Security Tests
-
-$Id$
-"""
-import zope.component
-from zope.security.interfaces import IPermission
-from zope.security.permission import Permission
-
-def addCheckerPublic():
- """Add the CheckerPublic permission as 'zope.Public'"""
-
- perm = Permission('zope.Public', 'Public',
- """Special permission used for resources that are always public
-
- The public permission is effectively an optimization, sine
- it allows security computation to be bypassed.
- """
- )
- gsm = zope.component.getGlobalSiteManager()
- gsm.registerUtility(perm, IPermission, perm.id)
+# i am a package
\ No newline at end of file
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/perm.zcml
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/perm.zcml 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/perm.zcml 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,13 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- i18n_domain="zope"
- >
-
- <include package="zope.app.security" file="meta.zcml"/>
-
- <permission
- id="Can.Do.It"
- title="A Permissive Permission"
- description="This permission lets you do anything" />
-
-</configure>
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/perm_duplicate.zcml
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/perm_duplicate.zcml 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/perm_duplicate.zcml 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,17 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- i18n_domain="zope">
-
- <include package="zope.app.security" file="meta.zcml"/>
-
- <permission
- id="Can.Do.It"
- title="A Permissive Permission"
- description="This permission lets you do anything" />
-
- <permission
- id="Can.Do.It"
- title="A Permissive Permission"
- description="This permission lets you do anything" />
-
-</configure>
Modified: zope.principalregistry/trunk/src/zope/principalregistry/tests/principal.zcml
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/principal.zcml 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/principal.zcml 2009-03-12 02:11:13 UTC (rev 97946)
@@ -3,7 +3,7 @@
i18n_domain="zope"
>
- <include package="zope.app.security" file="meta.zcml"/>
+ <include package="zope.principalregistry" file="meta.zcml"/>
<principal
id="zope.p1"
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_basicauthadapter.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_basicauthadapter.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_basicauthadapter.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,36 +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.
-#
-##############################################################################
-"""Test Basic Authentication Adapter
-
-$Id$
-"""
-import unittest
-from zope.testing import doctest
-
-def test_bbb_imports():
- """XXX: the place may change
- Let's check if original imports still work:
-
- >>> import zope.app.security.basicauthadapter as old
- >>> import zope.authentication.basicauthadapter as new
-
- >>> old.BasicAuthAdapter is new.BasicAuthAdapter
- True
-
- """
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocTestSuite(),
- ))
Added: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_doc.py
===================================================================
--- zope.principalregistry/trunk/src/zope/principalregistry/tests/test_doc.py (rev 0)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_doc.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -0,0 +1,45 @@
+##############################################################################
+#
+# 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 Serive or Principal Registry Tests
+
+$Id$
+"""
+import unittest
+from zope.testing import doctest
+from zope.component.testing import setUp as setUpComponent
+from zope.component.testing import tearDown as tearDownComponent
+from zope.configuration import xmlconfig
+from zope.password.testing import setUpPasswordManagers
+
+def setUp(test=None):
+ setUpComponent()
+ setUpPasswordManagers()
+
+def tearDown(test=None):
+ tearDownComponent()
+
+def zcml(s):
+ import zope.principalregistry
+ context = xmlconfig.file('meta.zcml', zope.principalregistry)
+ xmlconfig.string(s, context)
+
+def reset():
+ tearDown()
+ setUp()
+
+def test_suite():
+ return unittest.TestSuite((
+ doctest.DocFileSuite('../README.txt',
+ setUp=setUp, globs={'zcml': zcml, 'reset': reset}),
+ ))
Property changes on: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_doc.py
___________________________________________________________________
Added: svn:keywords
+ Id
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_ftpauth.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_ftpauth.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_ftpauth.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,36 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 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 Authentication Test
-
-$Id$
-"""
-import unittest
-from zope.testing import doctest
-
-def test_bbb_imports():
- """XXX: the place may change
- Let's check if original imports still work:
-
- >>> import zope.app.security.ftpauth as old
- >>> import zope.authentication.ftpauth as new
-
- >>> old.FTPAuth is new.FTPAuth
- True
-
- """
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocTestSuite(),
- ))
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_interfaces.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_interfaces.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_interfaces.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,66 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 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.
-#
-##############################################################################
-"""Test importability of BBB interfaces
-
-$Id$
-"""
-import unittest
-from zope.testing import doctest
-
-def test_bbb_imports():
- """
- Let's check that permission vocabularies that were moved to
- zope.security are still importable from original place.
-
- >>> import zope.app.security.interfaces as old
- >>> import zope.authentication.interfaces as new
-
- >>> old.PrincipalLookupError is new.PrincipalLookupError
- True
- >>> old.IUnauthenticatedPrincipal is new.IUnauthenticatedPrincipal
- True
- >>> old.IFallbackUnauthenticatedPrincipal is new.IFallbackUnauthenticatedPrincipal
- True
- >>> old.IUnauthenticatedGroup is new.IUnauthenticatedGroup
- True
- >>> old.IAuthenticatedGroup is new.IAuthenticatedGroup
- True
- >>> old.IEveryoneGroup is new.IEveryoneGroup
- True
- >>> old.IAuthentication is new.IAuthentication
- True
- >>> old.ILoginPassword is new.ILoginPassword
- True
- >>> old.IPrincipalSource is new.IPrincipalSource
- True
- >>> old.ILogout is new.ILogout
- True
- >>> old.ILogoutSupported is new.ILogoutSupported
- True
-
- >>> import zope.security.interfaces as new
-
- >>> old.IPrincipal is new.IPrincipal
- True
- >>> old.IPermission is new.IPermission
- True
- >>> old.IGroup is new.IGroup
- True
-
- """
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocTestSuite(),
- ))
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_loginpassword.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_loginpassword.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_loginpassword.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,36 +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.
-#
-##############################################################################
-"""Test Login and Password
-
-$Id$
-"""
-import unittest
-from zope.testing import doctest
-
-def test_bbb_imports():
- """
- Let's check that permission vocabularies that were moved to
- zope.security are still importable from original place.
-
- >>> import zope.authentication.loginpassword as new
- >>> import zope.app.security.loginpassword as old
- >>> old.LoginPassword is new.LoginPassword
- True
-
- """
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocTestSuite(),
- ))
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_logout.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_logout.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_logout.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,38 +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.
-#
-##############################################################################
-"""
-$Id$
-"""
-import unittest
-from zope.testing import doctest
-
-def test_bbb_imports():
- """
- Let's check if original imports still work:
-
- >>> import zope.app.security as old
- >>> import zope.authentication.logout as new
-
- >>> old.NoLogout is new.NoLogout
- True
-
- >>> old.LogoutSupported is new.LogoutSupported
- True
-
- """
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocTestSuite(),
- ))
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_permission.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_permission.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_permission.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,42 +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.
-#
-##############################################################################
-"""Doctests for 'permission' module.
-
-$Id$
-"""
-import unittest
-import doctest
-
-def test_bbb_imports():
- """
- Let's test that backward-compatibility imports still work:
-
- >>> from zope.app.security import permission as old
- >>> from zope.localpermission import permission as new
-
- >>> old.NULL_ID is new.NULL_ID
- True
- >>> old.LocalPermission is new.LocalPermission
- True
- >>> old.setIdOnActivation is new.setIdOnActivation
- True
- >>> old.unsetIdOnDeactivation is new.unsetIdOnDeactivation
- True
-
- """
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocTestSuite(),
- ))
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principal.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_principal.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principal.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,33 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 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.
-#
-##############################################################################
-"""Test bbb imports for checkPrincipal
-
-$Id$
-"""
-import unittest
-from zope.testing import doctest
-
-def test_bbb_imports():
- """
- >>> import zope.authentication.principal as new
- >>> import zope.app.security.principal as old
- >>> old.checkPrincipal is new.checkPrincipal
- True
-
- """
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocTestSuite(),
- ))
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principallogging.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_principallogging.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principallogging.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,39 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 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.
-#
-##############################################################################
-"""Test for PrincipalLogging.
-
-$Id$
-"""
-import unittest
-from zope.testing.doctestunit import DocTestSuite
-
-def test_bbb_imports():
- """
- Let's check that permission vocabularies that were moved to
- zope.security are still importable from original place.
-
- >>> import zope.publisher.principallogging as new
- >>> import zope.app.security.principallogging as old
- >>> old.PrincipalLogging is new.PrincipalLogging
- True
-
- """
-
-def test_suite():
- return unittest.TestSuite((
- DocTestSuite(),
- ))
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Modified: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principalregistry.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_principalregistry.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_principalregistry.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -16,19 +16,17 @@
$Id$
"""
import unittest
+from zope.authentication.basicauthadapter import BasicAuthAdapter
+from zope.authentication.interfaces import ILoginPassword, PrincipalLookupError
+from zope.component import provideAdapter
from zope.interface import implements
-from zope.app.security.interfaces import PrincipalLookupError
+from zope.password.testing import setUpPasswordManagers
from zope.publisher.interfaces.http import IHTTPCredentials
-from zope.app.testing import ztapi
-from zope.app.component.testing import PlacefulSetup
+from zope.principalregistry.principalregistry import PrincipalRegistry
+from zope.principalregistry.principalregistry import DuplicateLogin, DuplicateId
-from zope.app.security.basicauthadapter import BasicAuthAdapter
-from zope.app.security.interfaces import ILoginPassword
-from zope.app.security.principalregistry import PrincipalRegistry
-from zope.app.security.principalregistry import DuplicateLogin, DuplicateId
-
class Request(object):
implements(IHTTPCredentials)
@@ -44,16 +42,12 @@
self.challenge = challenge
-class Test(PlacefulSetup, unittest.TestCase):
+class Test(unittest.TestCase):
def setUp(self):
- PlacefulSetup.setUp(self)
-
- ztapi.provideAdapter(
- IHTTPCredentials, ILoginPassword, BasicAuthAdapter)
-
+ setUpPasswordManagers()
+ provideAdapter(BasicAuthAdapter)
self.reg = PrincipalRegistry()
-
self.reg.definePrincipal('1', 'Tim Peters', 'Sir Tim Peters',
'tim', '123')
self.reg.definePrincipal('2', 'Jim Fulton', 'Sir Jim Fulton',
@@ -151,6 +145,3 @@
return unittest.TestSuite((
unittest.makeSuite(Test),
))
-
-if __name__=='__main__':
- unittest.main(defaultTest='test_suite')
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_securitydirectives.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_securitydirectives.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_securitydirectives.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,79 +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.
-#
-##############################################################################
-"""Security Directives Tests
-
-$Id$
-"""
-import unittest
-from zope.configuration.config import ConfigurationConflictError
-from zope.configuration import xmlconfig
-
-from zope.component import getUtility
-from zope.app.testing import ztapi
-from zope.app.testing.placelesssetup import PlacelessSetup
-
-from zope.security.interfaces import IPermission
-from zope.app.security.interfaces import IAuthentication
-from zope.app.security.principalregistry import principalRegistry
-import zope.app.security.tests
-
-
-class TestBase(PlacelessSetup):
-
- def setUp(self):
- super(TestBase, self).setUp()
- ztapi.provideUtility(IAuthentication, principalRegistry)
-
-
-class TestPrincipalDirective(TestBase, unittest.TestCase):
-
- def testRegister(self):
- context = xmlconfig.file("principal.zcml", zope.app.security.tests)
- reg=principalRegistry
-
- p = reg.getPrincipal('zope.p1')
- self.assertEqual(p.id, 'zope.p1')
- self.assertEqual(p.title, 'Sir Tim Peters')
- self.assertEqual(p.description, 'Tim Peters')
- p = reg.getPrincipal('zope.p2')
- self.assertEqual(p.id, 'zope.p2')
- self.assertEqual(p.title, 'Sir Jim Fulton')
- self.assertEqual(p.description, 'Jim Fulton')
-
- self.assertEqual(len(reg.getPrincipals('')), 2)
-
-
-class TestPermissionDirective(TestBase, unittest.TestCase):
-
- def testRegister(self):
- context = xmlconfig.file("perm.zcml", zope.app.security.tests)
- perm = getUtility(IPermission, "Can.Do.It")
- self.failUnless(perm.id.endswith('Can.Do.It'))
- self.assertEqual(perm.title, 'A Permissive Permission')
- self.assertEqual(perm.description,
- 'This permission lets you do anything')
-
- def testDuplicationRegistration(self):
- self.assertRaises(ConfigurationConflictError, xmlconfig.file,
- "perm_duplicate.zcml", zope.app.security.tests)
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(TestPrincipalDirective),
- unittest.makeSuite(TestPermissionDirective),
- ))
-
-if __name__ == '__main__':
- unittest.main()
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/tests/test_vocabulary.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/tests/test_vocabulary.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/tests/test_vocabulary.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,42 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 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 vocabluary doc tests.
-
-$Id$
-"""
-import unittest
-from zope.testing import doctest
-
-def test_bbb_imports():
- """
- Let's check that permission vocabularies that were moved to
- zope.security are still importable from original place.
-
- >>> import zope.security.permission as new
- >>> import zope.app.security.vocabulary as old
- >>> old.PermissionsVocabulary is new.PermissionsVocabulary
- True
- >>> old.PermissionIdsVocabulary is new.PermissionIdsVocabulary
- True
-
- >>> import zope.authentication.principal as new
- >>> old.PrincipalSource is new.PrincipalSource
- True
-
- """
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocTestSuite(),
- ))
Deleted: zope.principalregistry/trunk/src/zope/principalregistry/vocabulary.py
===================================================================
--- zope.principalregistry/trunk/src/zope/app/security/vocabulary.py 2009-03-12 01:05:28 UTC (rev 97944)
+++ zope.principalregistry/trunk/src/zope/principalregistry/vocabulary.py 2009-03-12 02:11:13 UTC (rev 97946)
@@ -1,22 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 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.
-#
-##############################################################################
-"""Backward-compatibility imports for PrincipalSource and permission vocabularies.
-
-$Id$
-"""
-
-# BBB
-from zope.security.permission import PermissionsVocabulary
-from zope.security.permission import PermissionIdsVocabulary
-from zope.authentication.principal import PrincipalSource
More information about the Checkins
mailing list