zope.app.security-3.7.5/ 0000755 0001750 0001750 00000000000 11321726146 014755 5 ustar faassen faassen zope.app.security-3.7.5/setup.cfg 0000644 0001750 0001750 00000000073 11321726146 016576 0 ustar faassen faassen [egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
zope.app.security-3.7.5/bootstrap.py 0000644 0001750 0001750 00000003370 11321726135 017345 0 ustar faassen faassen ##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Bootstrap a buildout-based project
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
$Id: bootstrap.py 73551 2007-03-25 09:14:36Z dobe $
"""
import os, shutil, sys, tempfile, urllib2
tmpeggs = tempfile.mkdtemp()
ez = {}
exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
).read() in ez
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
import pkg_resources
cmd = 'from setuptools.command.easy_install import main; main()'
if sys.platform == 'win32':
cmd = '"%s"' % cmd # work around spawn lamosity on windows
ws = pkg_resources.working_set
assert os.spawnle(
os.P_WAIT, sys.executable, sys.executable,
'-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
dict(os.environ,
PYTHONPATH=
ws.find(pkg_resources.Requirement.parse('setuptools')).location
),
) == 0
ws.add_entry(tmpeggs)
ws.require('zc.buildout')
import zc.buildout.buildout
zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
shutil.rmtree(tmpeggs)
zope.app.security-3.7.5/buildout.cfg 0000644 0001750 0001750 00000000745 11321726135 017271 0 ustar faassen faassen [buildout]
parts = test checker coverage-test coverage-report
develop = .
[test]
recipe = zc.recipe.testrunner
eggs = zope.app.security [test]
[checker]
recipe = lovely.recipe:importchecker
path = src/zope/app/security
[coverage-test]
recipe = zc.recipe.testrunner
eggs = zope.app.security [test]
defaults = ['--coverage', '../../coverage']
[coverage-report]
recipe = zc.recipe.egg
eggs = z3c.coverage
scripts = coverage=coverage-report
arguments = ('coverage', 'coverage/report')
zope.app.security-3.7.5/src/ 0000755 0001750 0001750 00000000000 11321726146 015544 5 ustar faassen faassen zope.app.security-3.7.5/src/zope/ 0000755 0001750 0001750 00000000000 11321726146 016521 5 ustar faassen faassen zope.app.security-3.7.5/src/zope/__init__.py 0000644 0001750 0001750 00000000310 11321726135 020622 0 ustar faassen faassen # this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
zope.app.security-3.7.5/src/zope/app/ 0000755 0001750 0001750 00000000000 11321726146 017301 5 ustar faassen faassen zope.app.security-3.7.5/src/zope/app/__init__.py 0000644 0001750 0001750 00000000310 11321726135 021402 0 ustar faassen faassen # this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
zope.app.security-3.7.5/src/zope/app/security/ 0000755 0001750 0001750 00000000000 11321726146 021150 5 ustar faassen faassen zope.app.security-3.7.5/src/zope/app/security/tests/ 0000755 0001750 0001750 00000000000 11321726146 022312 5 ustar faassen faassen zope.app.security-3.7.5/src/zope/app/security/tests/__init__.py 0000644 0001750 0001750 00000001403 11321726134 024416 0 ustar faassen faassen ##############################################################################
#
# 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: __init__.py 97952 2009-03-12 03:23:55Z nadako $
"""
from zope.security.testing import addCheckerPublic # BBB
zope.app.security-3.7.5/src/zope/app/security/tests/test_interfaces.py 0000644 0001750 0001750 00000004137 11321726134 026050 0 ustar faassen faassen ##############################################################################
#
# 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: test_interfaces.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
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(),
))
zope.app.security-3.7.5/src/zope/app/security/tests/test_permission.py 0000644 0001750 0001750 00000002531 11321726134 026111 0 ustar faassen faassen ##############################################################################
#
# 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: test_permission.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
import unittest
from zope.testing 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.app.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(),
))
zope.app.security-3.7.5/src/zope/app/security/tests/tests.py 0000644 0001750 0001750 00000000661 11321726134 024026 0 ustar faassen faassen import os
import zope.app.testing.functional
import unittest
here = os.path.realpath(os.path.dirname(__file__))
PermissionsLayer = zope.app.testing.functional.ZCMLLayer(
os.path.join(here, "ftesting.zcml"), __name__,
"PermissionsLayer")
def test_suite():
suite = zope.app.testing.functional.FunctionalDocFileSuite(
'persistentlist.txt')
suite.layer = PermissionsLayer
return unittest.TestSuite([suite])
zope.app.security-3.7.5/src/zope/app/security/tests/persistentlist.txt 0000644 0001750 0001750 00000003507 11321726134 026151 0 ustar faassen faassen ##############################################################################
#
# 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.
#
##############################################################################
"""Persistent List functional tests.
"""
Let's check that we can access the data attribute of a proxied
PersistentList. This is to accomodate UserList operations which are
used when an isinstance call will correctly identify a persistent list
as a UserList. Some configurations may get incorrect behavior currently,
such that isinstance claims that a proxied UserList is not a UserList.
For these configurations this should not make a difference.
Because several UserList methods use this isinstance check before
accessing the data attribute we will simply try to get the data
attribute from a proxied example.
>>> import persistent.list
>>> import zope.security.tests.test_proxy
>>> import zope.security.proxy
>>> persistent_list = persistent.list.PersistentList()
>>> proxied_list = zope.security.proxy.ProxyFactory(
... persistent_list)
>>> proxied_list.data
[]
We'll do the same with a persistent dict, which follows the same
behavior pattern with UserDict.
>>> import persistent.dict
>>> persistent_dict = persistent.dict.PersistentDict()
>>> proxied_dict = zope.security.proxy.ProxyFactory(
... persistent_dict)
>>> proxied_dict.data
{}
zope.app.security-3.7.5/src/zope/app/security/tests/ftesting.zcml 0000644 0001750 0001750 00000000435 11321726134 025023 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope/app/security/tests/test_ftpauth.py 0000644 0001750 0001750 00000002117 11321726134 025374 0 ustar faassen faassen ##############################################################################
#
# 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: test_ftpauth.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
import unittest
from zope.testing import doctest
def test_bbb_imports():
"""
Let's check if original imports still work:
>>> import zope.app.security.ftpauth as old
>>> import zope.publisher.ftp as new
>>> old.FTPAuth is new.FTPAuth
True
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
))
zope.app.security-3.7.5/src/zope/app/security/tests/test_principalregistry.py 0000644 0001750 0001750 00000006147 11321726134 027502 0 ustar faassen faassen ##############################################################################
#
# 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: test_principalregistry.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
import unittest
from zope.testing import doctest
def test_bbb_imports():
"""
Let's check that principal registry that was moved to
zope.principalregistry is still importable from original places.
>>> import zope.app.security.principalregistry as old
>>> import zope.principalregistry.principalregistry as new
>>> old.DuplicateLogin is new.DuplicateLogin
True
>>> old.DuplicateId is new.DuplicateId
True
>>> old.PrincipalRegistry is new.PrincipalRegistry
True
>>> old.principalRegistry is new.principalRegistry
True
>>> old.PrincipalBase is new.PrincipalBase
True
>>> old.Group is new.Group
True
>>> old.Principal is new.Principal
True
>>> old.UnauthenticatedPrincipal is new.UnauthenticatedPrincipal
True
>>> old.fallback_unauthenticated_principal is new.fallback_unauthenticated_principal
True
>>> old.UnauthenticatedGroup is new.UnauthenticatedGroup
True
>>> old.AuthenticatedGroup is new.AuthenticatedGroup
True
>>> old.EverybodyGroup is new.EverybodyGroup
True
>>> import zope.app.security.metadirectives as old
>>> import zope.principalregistry.metadirectives as new
>>> old.IBasePrincipalDirective is new.IBasePrincipalDirective
True
>>> old.IDefinePrincipalDirective is new.IDefinePrincipalDirective
True
>>> old.IDefineUnauthenticatedPrincipalDirective is new.IDefineUnauthenticatedPrincipalDirective
True
>>> old.IDefineUnauthenticatedGroupDirective is new.IDefineUnauthenticatedGroupDirective
True
>>> old.IDefineAuthenticatedGroupDirective is new.IDefineAuthenticatedGroupDirective
True
>>> old.IDefineEverybodyGroupDirective is new.IDefineEverybodyGroupDirective
True
>>> import zope.app.security.metaconfigure as old
>>> import zope.principalregistry.metaconfigure as new
>>> old.principal is new.principal
True
>>> old.unauthenticatedPrincipal is new.unauthenticatedPrincipal
True
>>> old.unauthenticatedGroup is new.unauthenticatedGroup
True
>>> old.authenticatedGroup is new.authenticatedGroup
True
>>> old.everybodyGroup is new.everybodyGroup
True
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
))
zope.app.security-3.7.5/src/zope/app/security/tests/test_logout.py 0000644 0001750 0001750 00000002171 11321726134 025232 0 ustar faassen faassen ##############################################################################
#
# 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: test_logout.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
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(),
))
zope.app.security-3.7.5/src/zope/app/security/tests/test_basicauthadapter.py 0000644 0001750 0001750 00000002204 11321726134 027222 0 ustar faassen faassen ##############################################################################
#
# 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: test_basicauthadapter.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
import unittest
from zope.testing import doctest
def test_bbb_imports():
"""
Let's check if original imports still work:
>>> import zope.app.security.basicauthadapter as old
>>> import zope.publisher.http as new
>>> old.BasicAuthAdapter is new.BasicAuthAdapter
True
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
))
zope.app.security-3.7.5/src/zope/app/security/tests/test_principal.py 0000644 0001750 0001750 00000002106 11321726134 025700 0 ustar faassen faassen ##############################################################################
#
# 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: test_principal.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
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(),
))
zope.app.security-3.7.5/src/zope/app/security/tests/test_principallogging.py 0000644 0001750 0001750 00000002316 11321726134 027252 0 ustar faassen faassen ##############################################################################
#
# 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: test_principallogging.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
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.publisher.principallogging as new
>>> import zope.app.security.principallogging as old
>>> old.PrincipalLogging is new.PrincipalLogging
True
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
))
zope.app.security-3.7.5/src/zope/app/security/tests/test_loginpassword.py 0000644 0001750 0001750 00000002307 11321726134 026615 0 ustar faassen faassen ##############################################################################
#
# 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: test_loginpassword.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
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(),
))
zope.app.security-3.7.5/src/zope/app/security/tests/test_vocabulary.py 0000644 0001750 0001750 00000002622 11321726134 026071 0 ustar faassen faassen ##############################################################################
#
# 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: test_vocabulary.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
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(),
))
zope.app.security-3.7.5/src/zope/app/security/__init__.py 0000644 0001750 0001750 00000001524 11321726135 023261 0 ustar faassen faassen ##############################################################################
#
# 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: __init__.py 97950 2009-03-12 03:14:02Z nadako $
"""
# BBB: the code was moved to zope.authentication
from zope.authentication.logout import LogoutSupported, NoLogout
zope.app.security-3.7.5/src/zope/app/security/metadirectives.py 0000644 0001750 0001750 00000002170 11321726135 024530 0 ustar faassen faassen ##############################################################################
#
# 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 imports for the global principal registry directives
$Id: metadirectives.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
# BBB: these were moved to zope.principalregistry
from zope.principalregistry.metadirectives import (
IBasePrincipalDirective,
IDefinePrincipalDirective,
IDefineUnauthenticatedPrincipalDirective,
IDefineUnauthenticatedGroupDirective,
IDefineAuthenticatedGroupDirective,
IDefineEverybodyGroupDirective,
)
zope.app.security-3.7.5/src/zope/app/security/standardpermissions.zcml 0000644 0001750 0001750 00000001323 11321726135 026130 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope/app/security/vocabulary.py 0000644 0001750 0001750 00000001705 11321726135 023672 0 ustar faassen faassen ##############################################################################
#
# 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: vocabulary.py 97943 2009-03-12 00:38:29Z nadako $
"""
# BBB
from zope.security.permission import PermissionsVocabulary
from zope.security.permission import PermissionIdsVocabulary
from zope.authentication.principal import PrincipalSource
zope.app.security-3.7.5/src/zope/app/security/_protections.py 0000644 0001750 0001750 00000001402 11321726135 024225 0 ustar faassen faassen ##############################################################################
#
# 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
#
##############################################################################
"""
$Id: _protections.py 97950 2009-03-12 03:14:02Z nadako $
"""
def protect():
pass # this function is not needed anymore
zope.app.security-3.7.5/src/zope/app/security/ftpauth.py 0000644 0001750 0001750 00000001460 11321726135 023174 0 ustar faassen faassen ##############################################################################
#
# 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: ftpauth.py 98044 2009-03-13 19:39:44Z nadako $
"""
# BBB
from zope.publisher.ftp import FTPAuth
zope.app.security-3.7.5/src/zope/app/security/metaconfigure.py 0000644 0001750 0001750 00000001675 11321726135 024361 0 ustar faassen faassen ##############################################################################
#
# 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 imports for the global principal registry directives
$Id: metaconfigure.py 97947 2009-03-12 02:31:26Z nadako $
"""
from zope.principalregistry.metaconfigure import (
principal,
unauthenticatedPrincipal,
unauthenticatedGroup,
authenticatedGroup,
everybodyGroup,
)
zope.app.security-3.7.5/src/zope/app/security/principal.py 0000644 0001750 0001750 00000001471 11321726135 023504 0 ustar faassen faassen ##############################################################################
#
# 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: principal.py 97943 2009-03-12 00:38:29Z nadako $
"""
# BBB
from zope.authentication.principal import checkPrincipal
zope.app.security-3.7.5/src/zope/app/security/globalmodules.zcml 0000644 0001750 0001750 00000035064 11321726135 024676 0 ustar faassen faassen
>
zope.app.security-3.7.5/src/zope/app/security/settings.py 0000644 0001750 0001750 00000002420 11321726135 023356 0 ustar faassen faassen ##############################################################################
#
# 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: settings.py 97750 2009-03-10 00:47:21Z nadako $
"""
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.')
zope.app.security-3.7.5/src/zope/app/security/protectclass.py 0000644 0001750 0001750 00000002101 11321726135 024220 0 ustar faassen faassen ##############################################################################
#
# 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: protectclass.py 95310 2009-01-28 13:16:45Z brandon_rhodes $
"""
from zope.security.checker import defineChecker, getCheckerForInstancesOf
from zope.security.checker import Checker, CheckerPublic
from zope.security.protectclass import (protectName,
protectSetAttribute,
protectLikeUnto)
zope.app.security-3.7.5/src/zope/app/security/interfaces.py 0000644 0001750 0001750 00000002202 11321726135 023637 0 ustar faassen faassen ##############################################################################
#
# 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: interfaces.py 97943 2009-03-12 00:38:29Z nadako $
"""
# 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,
)
zope.app.security-3.7.5/src/zope/app/security/loginpassword.py 0000644 0001750 0001750 00000001510 11321726135 024410 0 ustar faassen faassen ##############################################################################
#
# 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: loginpassword.py 97943 2009-03-12 00:38:29Z nadako $
"""
# BBB
from zope.authentication.loginpassword import LoginPassword
zope.app.security-3.7.5/src/zope/app/security/configure.zcml 0000644 0001750 0001750 00000000623 11321726135 024017 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope/app/security/i18n.py 0000644 0001750 0001750 00000001307 11321726135 022300 0 ustar faassen faassen ##############################################################################
#
# 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")
zope.app.security-3.7.5/src/zope/app/security/meta.zcml 0000644 0001750 0001750 00000000272 11321726135 022764 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope/app/security/permission.py 0000644 0001750 0001750 00000001750 11321726135 023713 0 ustar faassen faassen ##############################################################################
#
# 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.app.localpermission.
$Id: permission.py 98062 2009-03-13 23:49:38Z nadako $
"""
__docformat__ = 'restructuredtext'
# BBB: the functionality was moved to zope.app.localpermission
from zope.app.localpermission.permission import (
NULL_ID,
LocalPermission,
setIdOnActivation,
unsetIdOnDeactivation,
)
zope.app.security-3.7.5/src/zope/app/security/browser/ 0000755 0001750 0001750 00000000000 11321726146 022633 5 ustar faassen faassen zope.app.security-3.7.5/src/zope/app/security/browser/__init__.py 0000644 0001750 0001750 00000001311 11321726132 024733 0 ustar faassen faassen ##############################################################################
#
# 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 Views
$Id: __init__.py 29365 2005-03-01 18:32:59Z sidnei $
"""
zope.app.security-3.7.5/src/zope/app/security/browser/logout.pt 0000644 0001750 0001750 00000001745 11321726132 024513 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope/app/security/browser/tests.py 0000644 0001750 0001750 00000002376 11321726132 024352 0 ustar faassen faassen ##############################################################################
#
# 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 Views Tests
$Id: tests.py 106799 2009-12-20 04:50:49Z fafhrd $
"""
__docformat__ = "reStructuredText"
import unittest
from zope.testing import doctest
def test_bbb_imports():
"""
>>> import zope.app.security.browser.principalterms as old
>>> import zope.authentication.principal as new
>>> old.PrincipalTerms is new.PrincipalTerms
True
>>> old.Term is new.PrincipalTerm
True
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(),
doctest.DocFileSuite('authutilitysearchview.txt'),
doctest.DocFileSuite('loginlogout.txt'),
))
zope.app.security-3.7.5/src/zope/app/security/browser/loginlogout.txt 0000644 0001750 0001750 00000005022 11321726132 025730 0 ustar faassen faassen ====================
Login/Logout Snippet
====================
The class LoginLogout:
>>> from zope.app.security.browser.auth import LoginLogout
is used as a view to generate an HTML snippet suitable for logging in or
logging out based on whether or not the current principal is authenticated.
When the current principal is unauthenticated, it provides
IUnauthenticatedPrincipal:
>>> from zope.authentication.interfaces import IUnauthenticatedPrincipal
>>> from zope.principalregistry.principalregistry import UnauthenticatedPrincipal
>>> anonymous = UnauthenticatedPrincipal('anon', '', '')
>>> IUnauthenticatedPrincipal.providedBy(anonymous)
True
When LoginLogout is used for a request that has an unauthenticated principal,
it provides the user with a link to 'Login':
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> request.setPrincipal(anonymous)
>>> LoginLogout(None, request)()
u'[Login]'
Logout, however, behaves differently. Not all authentication protocols (i.e.
credentials extractors/challengers) support 'logout'. Furthermore, we don't
know how an admin may have configured Zope's authentication. Our solution is
to rely on the admin to tell us explicitly that the site supports logout.
By default, the LoginLogout snippet will not provide a logout link for an
unauthenticated principal. To illustrate, we'll first setup a request with an
unauthenticated principal:
>>> from zope.security.interfaces import IPrincipal
>>> from zope.interface import implements
>>> class Bob:
... implements(IPrincipal)
... id = 'bob'
... title = description = ''
>>> bob = Bob()
>>> IUnauthenticatedPrincipal.providedBy(bob)
False
>>> request.setPrincipal(bob)
In this case, the default behavior is to return None for the snippet:
>>> print LoginLogout(None, request)()
None
To show a logout prompt, an admin must register a marker adapter that provides
the interface:
>>> from zope.authentication.interfaces import ILogoutSupported
This flags to LoginLogout that the site supports logout. There is a 'no-op'
adapter that can be registered for this:
>>> from zope.authentication.logout import LogoutSupported
>>> from zope.component import provideAdapter
>>> provideAdapter(LogoutSupported, (None,), ILogoutSupported)
Now when we use LoginLogout with an unauthenticated principal, we get a logout
prompt:
>>> LoginLogout(None, request)()
u'[Logout]'
zope.app.security-3.7.5/src/zope/app/security/browser/redirect.pt 0000644 0001750 0001750 00000002223 11321726132 024773 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope/app/security/browser/configure.zcml 0000644 0001750 0001750 00000002436 11321726132 025503 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope/app/security/browser/authutilitysearchview.pt 0000644 0001750 0001750 00000001137 11321726132 027643 0 ustar faassen faassen
principals.zcml
zope.app.security-3.7.5/src/zope/app/security/browser/auth.py 0000644 0001750 0001750 00000011627 11321726132 024150 0 ustar faassen faassen ##############################################################################
#
# 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.
#
##############################################################################
"""Login and Logout screens
$Id: auth.py 97952 2009-03-12 03:23:55Z nadako $
"""
import urllib
from zope import component
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.app.publisher.interfaces.http import ILogin
from zope.authentication.interfaces import IAuthentication
from zope.authentication.interfaces import IUnauthenticatedPrincipal
from zope.authentication.interfaces import ILogout, ILogoutSupported
from zope.i18n import translate
from zope.interface import implements
from zope.app.security.i18n import _
class AuthUtilitySearchView(object):
template = ViewPageTemplateFile('authutilitysearchview.pt')
searchTitle = u'principals.zcml'
def __init__(self, context, request):
self.context = context
self.request = request
def render(self, name):
return self.template(title=self.searchTitle, name=name)
def results(self, name):
if not (name+'.search' in self.request):
return None
searchstring = self.request[name+'.searchstring']
return [principal.id
for principal in self.context.getPrincipals(searchstring)]
class HTTPAuthenticationLogin(object):
implements(ILogin)
confirmation = ViewPageTemplateFile('login.pt')
failed = ViewPageTemplateFile('login_failed.pt')
def login(self, nextURL=None):
# we don't want to keep challenging if we're authenticated
if IUnauthenticatedPrincipal.providedBy(self.request.principal):
component.getUtility(IAuthentication).unauthorized(
self.request.principal.id, self.request)
return self.failed()
else:
if nextURL is None:
return self.confirmation()
else:
self.request.response.redirect(nextURL)
class HTTPBasicAuthenticationLogin(HTTPAuthenticationLogin):
"""Issues a challenge to the browser to get basic auth credentials.
This view can be used as a fail safe login in the even the normal login
fails because of an improperly configured authentication utility.
The failsafeness of this view relies on the fact that the global principal
registry, which typically contains an adminitrator principal, uses basic
auth credentials to authenticate.
"""
def login(self, nextURL=None):
# we don't want to keep challenging if we're authenticated
if IUnauthenticatedPrincipal.providedBy(self.request.principal):
# hard-code basic auth challenge
self.request.unauthorized('basic realm="Zope"')
return self.failed()
else:
if nextURL is None:
return self.confirmation()
else:
self.request.response.redirect(nextURL)
class HTTPAuthenticationLogout(object):
"""Since HTTP Authentication really does not know about logout, we are
simply challenging the client again."""
implements(ILogout)
confirmation = ViewPageTemplateFile('logout.pt')
redirect = ViewPageTemplateFile('redirect.pt')
def __init__(self, context, request):
self.context = context
self.request = request
def logout(self, nextURL=None):
if not IUnauthenticatedPrincipal.providedBy(self.request.principal):
auth = component.getUtility(IAuthentication)
ILogout(auth).logout(self.request)
if nextURL:
return self.redirect()
if nextURL is None:
return self.confirmation()
else:
return self.request.response.redirect(nextURL)
class LoginLogout(object):
def __init__(self, context, request):
self.context = context
self.request = request
def __call__(self):
if IUnauthenticatedPrincipal.providedBy(self.request.principal):
return u'%s' % (
urllib.quote(self.request.getURL()),
translate(_('[Login]'), context=self.request,
default='[Login]'))
elif ILogoutSupported(self.request, None) is not None:
return u'%s' % (
urllib.quote(self.request.getURL()),
translate(_('[Logout]'), context=self.request,
default='[Logout]'))
else:
return None
zope.app.security-3.7.5/src/zope/app/security/browser/principalterms.py 0000644 0001750 0001750 00000001563 11321726132 026241 0 ustar faassen faassen ##############################################################################
#
# 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 principal terms
$Id: principalterms.py 97943 2009-03-12 00:38:29Z nadako $
"""
# BBB
from zope.authentication.principal import PrincipalTerm as Term
from zope.authentication.principal import PrincipalTerms
zope.app.security-3.7.5/src/zope/app/security/browser/authutilitysearchview.txt 0000644 0001750 0001750 00000003446 11321726132 030044 0 ustar faassen faassen ===========================================
The Query View for Authentication Utilities
===========================================
A regular authentication service will not provide the `ISourceQueriables`
interface, but it is a queriable itself, since it provides the simple
`getPrincipals(name)` method:
>>> class Principal:
... def __init__(self, id):
... self.id = id
>>> class MyAuthUtility:
... data = {'jim': Principal(42), 'don': Principal(0),
... 'stephan': Principal(1)}
...
... def getPrincipals(self, name):
... return [principal
... for id, principal in self.data.items()
... if name in id]
Now that we have our queriable, we create the view for it:
>>> from zope.app.security.browser.auth import AuthUtilitySearchView
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> view = AuthUtilitySearchView(MyAuthUtility(), request)
This allows us to render a search form.
>>> print view.render('test') # doctest: +NORMALIZE_WHITESPACE
principals.zcml
If we ask for results:
>>> view.results('test')
We don't get any, since we did not provide any. But if we give input:
>>> request.form['test.searchstring'] = 'n'
we still don't get any:
>>> view.results('test')
because we did not press the button. So let's press the button:
>>> request.form['test.search'] = 'Search'
so that we now get results (!):
>>> ids = list(view.results('test'))
>>> ids.sort()
>>> ids
[0, 1]
zope.app.security-3.7.5/src/zope/app/security/browser/login_failed.pt 0000644 0001750 0001750 00000000717 11321726132 025614 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope/app/security/browser/login.pt 0000644 0001750 0001750 00000000717 11321726132 024310 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope/app/security/basicauthadapter.py 0000644 0001750 0001750 00000001502 11321726135 025022 0 ustar faassen faassen ##############################################################################
#
# 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: basicauthadapter.py 107659 2010-01-04 21:55:37Z faassen $
"""
# BBB
from zope.login.http import BasicAuthAdapter
zope.app.security-3.7.5/src/zope/app/security/principallogging.py 0000644 0001750 0001750 00000001534 11321726135 025053 0 ustar faassen faassen ##############################################################################
#
# 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: principallogging.py 97916 2009-03-11 21:10:57Z nadako $
"""
# BBB: this was moved to zope.publisher.
from zope.publisher.principallogging import PrincipalLogging
zope.app.security-3.7.5/src/zope/app/security/principalregistry.py 0000644 0001750 0001750 00000002206 11321726135 025272 0 ustar faassen faassen ##############################################################################
#
# 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 imports for the global principal registry
$Id: principalregistry.py 97947 2009-03-12 02:31:26Z nadako $
"""
# BBB: these were moved to zope.principalregistry
from zope.principalregistry.principalregistry import (
DuplicateLogin,
DuplicateId,
PrincipalRegistry,
principalRegistry,
PrincipalBase,
Group,
Principal,
UnauthenticatedPrincipal,
fallback_unauthenticated_principal,
UnauthenticatedGroup,
AuthenticatedGroup,
EverybodyGroup,
)
zope.app.security-3.7.5/src/zope/app/security/_protections.zcml 0000644 0001750 0001750 00000012152 11321726135 024546 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope.app.security.egg-info/ 0000755 0001750 0001750 00000000000 11321726146 022640 5 ustar faassen faassen zope.app.security-3.7.5/src/zope.app.security.egg-info/SOURCES.txt 0000644 0001750 0001750 00000004543 11321726142 024526 0 ustar faassen faassen CHANGES.txt
README.txt
bootstrap.py
buildout.cfg
setup.py
src/zope/__init__.py
src/zope.app.security.egg-info/PKG-INFO
src/zope.app.security.egg-info/SOURCES.txt
src/zope.app.security.egg-info/dependency_links.txt
src/zope.app.security.egg-info/namespace_packages.txt
src/zope.app.security.egg-info/not-zip-safe
src/zope.app.security.egg-info/requires.txt
src/zope.app.security.egg-info/top_level.txt
src/zope/app/__init__.py
src/zope/app/security/__init__.py
src/zope/app/security/_protections.py
src/zope/app/security/_protections.zcml
src/zope/app/security/basicauthadapter.py
src/zope/app/security/configure.zcml
src/zope/app/security/ftpauth.py
src/zope/app/security/globalmodules.zcml
src/zope/app/security/i18n.py
src/zope/app/security/interfaces.py
src/zope/app/security/loginpassword.py
src/zope/app/security/meta.zcml
src/zope/app/security/metaconfigure.py
src/zope/app/security/metadirectives.py
src/zope/app/security/permission.py
src/zope/app/security/principal.py
src/zope/app/security/principallogging.py
src/zope/app/security/principalregistry.py
src/zope/app/security/protectclass.py
src/zope/app/security/settings.py
src/zope/app/security/standardpermissions.zcml
src/zope/app/security/vocabulary.py
src/zope/app/security/browser/__init__.py
src/zope/app/security/browser/auth.py
src/zope/app/security/browser/authutilitysearchview.pt
src/zope/app/security/browser/authutilitysearchview.txt
src/zope/app/security/browser/configure.zcml
src/zope/app/security/browser/login.pt
src/zope/app/security/browser/login_failed.pt
src/zope/app/security/browser/loginlogout.txt
src/zope/app/security/browser/logout.pt
src/zope/app/security/browser/principalterms.py
src/zope/app/security/browser/redirect.pt
src/zope/app/security/browser/tests.py
src/zope/app/security/tests/__init__.py
src/zope/app/security/tests/ftesting.zcml
src/zope/app/security/tests/persistentlist.txt
src/zope/app/security/tests/test_basicauthadapter.py
src/zope/app/security/tests/test_ftpauth.py
src/zope/app/security/tests/test_interfaces.py
src/zope/app/security/tests/test_loginpassword.py
src/zope/app/security/tests/test_logout.py
src/zope/app/security/tests/test_permission.py
src/zope/app/security/tests/test_principal.py
src/zope/app/security/tests/test_principallogging.py
src/zope/app/security/tests/test_principalregistry.py
src/zope/app/security/tests/test_vocabulary.py
src/zope/app/security/tests/tests.py zope.app.security-3.7.5/src/zope.app.security.egg-info/dependency_links.txt 0000644 0001750 0001750 00000000001 11321726142 026702 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope.app.security.egg-info/top_level.txt 0000644 0001750 0001750 00000000005 11321726142 025361 0 ustar faassen faassen zope
zope.app.security-3.7.5/src/zope.app.security.egg-info/namespace_packages.txt 0000644 0001750 0001750 00000000016 11321726142 027164 0 ustar faassen faassen zope
zope.app
zope.app.security-3.7.5/src/zope.app.security.egg-info/PKG-INFO 0000644 0001750 0001750 00000033206 11321726142 023735 0 ustar faassen faassen Metadata-Version: 1.0
Name: zope.app.security
Version: 3.7.5
Summary: ZMI Views For Zope3 Security Components
Home-page: http://pypi.python.org/pypi/zope.app.security
Author: Zope Foundation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: This package provides ZMI browser views for Zope security components.
It used to provide a large part of security functionality for Zope 3, but it was
factored out from this package to several little packages to reduce dependencies
and improve reusability.
The functionality was splitted into these new packages:
* zope.authentication - the IAuthentication interface and related utilities.
* zope.principalregistry - the global principal registry and its zcml directives.
* zope.app.localpermission - the LocalPermission class that implements
persistent permissions.
The rest of functionality that were provided by this package is merged into
``zope.security`` and ``zope.publisher``.
Backward-compatibility imports are provided to ensure that older applications
work. See CHANGES.txt for more info.
Detailed Documentation
======================
===========================================
The Query View for Authentication Utilities
===========================================
A regular authentication service will not provide the `ISourceQueriables`
interface, but it is a queriable itself, since it provides the simple
`getPrincipals(name)` method:
>>> class Principal:
... def __init__(self, id):
... self.id = id
>>> class MyAuthUtility:
... data = {'jim': Principal(42), 'don': Principal(0),
... 'stephan': Principal(1)}
...
... def getPrincipals(self, name):
... return [principal
... for id, principal in self.data.items()
... if name in id]
Now that we have our queriable, we create the view for it:
>>> from zope.app.security.browser.auth import AuthUtilitySearchView
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> view = AuthUtilitySearchView(MyAuthUtility(), request)
This allows us to render a search form.
>>> print view.render('test') # doctest: +NORMALIZE_WHITESPACE
principals.zcml
If we ask for results:
>>> view.results('test')
We don't get any, since we did not provide any. But if we give input:
>>> request.form['test.searchstring'] = 'n'
we still don't get any:
>>> view.results('test')
because we did not press the button. So let's press the button:
>>> request.form['test.search'] = 'Search'
so that we now get results (!):
>>> ids = list(view.results('test'))
>>> ids.sort()
>>> ids
[0, 1]
====================
Login/Logout Snippet
====================
The class LoginLogout:
>>> from zope.app.security.browser.auth import LoginLogout
is used as a view to generate an HTML snippet suitable for logging in or
logging out based on whether or not the current principal is authenticated.
When the current principal is unauthenticated, it provides
IUnauthenticatedPrincipal:
>>> from zope.authentication.interfaces import IUnauthenticatedPrincipal
>>> from zope.principalregistry.principalregistry import UnauthenticatedPrincipal
>>> anonymous = UnauthenticatedPrincipal('anon', '', '')
>>> IUnauthenticatedPrincipal.providedBy(anonymous)
True
When LoginLogout is used for a request that has an unauthenticated principal,
it provides the user with a link to 'Login':
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> request.setPrincipal(anonymous)
>>> LoginLogout(None, request)()
u'[Login]'
Logout, however, behaves differently. Not all authentication protocols (i.e.
credentials extractors/challengers) support 'logout'. Furthermore, we don't
know how an admin may have configured Zope's authentication. Our solution is
to rely on the admin to tell us explicitly that the site supports logout.
By default, the LoginLogout snippet will not provide a logout link for an
unauthenticated principal. To illustrate, we'll first setup a request with an
unauthenticated principal:
>>> from zope.security.interfaces import IPrincipal
>>> from zope.interface import implements
>>> class Bob:
... implements(IPrincipal)
... id = 'bob'
... title = description = ''
>>> bob = Bob()
>>> IUnauthenticatedPrincipal.providedBy(bob)
False
>>> request.setPrincipal(bob)
In this case, the default behavior is to return None for the snippet:
>>> print LoginLogout(None, request)()
None
To show a logout prompt, an admin must register a marker adapter that provides
the interface:
>>> from zope.authentication.interfaces import ILogoutSupported
This flags to LoginLogout that the site supports logout. There is a 'no-op'
adapter that can be registered for this:
>>> from zope.authentication.logout import LogoutSupported
>>> from zope.component import provideAdapter
>>> provideAdapter(LogoutSupported, (None,), ILogoutSupported)
Now when we use LoginLogout with an unauthenticated principal, we get a logout
prompt:
>>> LoginLogout(None, request)()
u'[Logout]'
=======
CHANGES
=======
3.7.5 (2010-01-08)
------------------
- Move 'zope.ManageApplication' permission to zope.app.applicationcontrol
- Fix tests using a newer zope.publisher that requires zope.login.
3.7.3 (2009-11-29)
------------------
- provide a clean zope setup and move zope.app.testing to a test dependency
- removed unused dependencies like ZODB3 etc. from install_requires
3.7.2 (2009-09-10)
------------------
- Added data attribute to '_protections.zcml' for PersistentList
and PersistentDict to accomodate UserList and UserDict behavior
when they are proxied.
3.7.1 (2009-08-15)
------------------
- Changed globalmodules.zcml to avoid making declarations for
deprecated standard modules, to avoid deprecation warnings.
Note that globalmodules.zcml should be avoided. It's better to make
declarations for only what you actually need to use.
3.7.0 (2009-03-14)
------------------
- 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 "global principal registry" along with its zcml directives was moved into
new "zope.principalregistry" 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 as well as some other
common permissions, like "zope.View" have been moved to ``zope.security``.
Its configure.zcml is now included by this package.
- The "protect" function is now a no-op and is not needed anymore, because
zope.security now knows about i18n messages and __name__ and __parent__
attributes and won't protect them by default.
- The addCheckerPublic was moved from zope.app.security.tests to
zope.security.testing. Backward-compatibility import is provided.
- The ``LocalPermission`` class is now moved to new ``zope.app.localpermission``
package. This package now only has backward-compatibility imports and
zcml includes.
- Cleanup dependencies after refactorings. Also, don't depend on
zope.app.testing for tests anymore.
- Update package's description to point about refactorings done.
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 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.
Keywords: zope security authentication principal ftp http
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Framework :: Zope3
zope.app.security-3.7.5/src/zope.app.security.egg-info/not-zip-safe 0000644 0001750 0001750 00000000001 11321726135 025064 0 ustar faassen faassen
zope.app.security-3.7.5/src/zope.app.security.egg-info/requires.txt 0000644 0001750 0001750 00000000415 11321726142 025234 0 ustar faassen faassen setuptools
zope.app.localpermission
zope.app.pagetemplate
zope.app.publisher
zope.authentication
zope.i18n
zope.i18nmessageid
zope.interface
zope.principalregistry
zope.publisher >= 3.12
zope.security
zope.securitypolicy
zope.login
[test]
zope.app.testing
zope.testing zope.app.security-3.7.5/PKG-INFO 0000644 0001750 0001750 00000033206 11321726146 016056 0 ustar faassen faassen Metadata-Version: 1.0
Name: zope.app.security
Version: 3.7.5
Summary: ZMI Views For Zope3 Security Components
Home-page: http://pypi.python.org/pypi/zope.app.security
Author: Zope Foundation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: This package provides ZMI browser views for Zope security components.
It used to provide a large part of security functionality for Zope 3, but it was
factored out from this package to several little packages to reduce dependencies
and improve reusability.
The functionality was splitted into these new packages:
* zope.authentication - the IAuthentication interface and related utilities.
* zope.principalregistry - the global principal registry and its zcml directives.
* zope.app.localpermission - the LocalPermission class that implements
persistent permissions.
The rest of functionality that were provided by this package is merged into
``zope.security`` and ``zope.publisher``.
Backward-compatibility imports are provided to ensure that older applications
work. See CHANGES.txt for more info.
Detailed Documentation
======================
===========================================
The Query View for Authentication Utilities
===========================================
A regular authentication service will not provide the `ISourceQueriables`
interface, but it is a queriable itself, since it provides the simple
`getPrincipals(name)` method:
>>> class Principal:
... def __init__(self, id):
... self.id = id
>>> class MyAuthUtility:
... data = {'jim': Principal(42), 'don': Principal(0),
... 'stephan': Principal(1)}
...
... def getPrincipals(self, name):
... return [principal
... for id, principal in self.data.items()
... if name in id]
Now that we have our queriable, we create the view for it:
>>> from zope.app.security.browser.auth import AuthUtilitySearchView
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> view = AuthUtilitySearchView(MyAuthUtility(), request)
This allows us to render a search form.
>>> print view.render('test') # doctest: +NORMALIZE_WHITESPACE
principals.zcml
If we ask for results:
>>> view.results('test')
We don't get any, since we did not provide any. But if we give input:
>>> request.form['test.searchstring'] = 'n'
we still don't get any:
>>> view.results('test')
because we did not press the button. So let's press the button:
>>> request.form['test.search'] = 'Search'
so that we now get results (!):
>>> ids = list(view.results('test'))
>>> ids.sort()
>>> ids
[0, 1]
====================
Login/Logout Snippet
====================
The class LoginLogout:
>>> from zope.app.security.browser.auth import LoginLogout
is used as a view to generate an HTML snippet suitable for logging in or
logging out based on whether or not the current principal is authenticated.
When the current principal is unauthenticated, it provides
IUnauthenticatedPrincipal:
>>> from zope.authentication.interfaces import IUnauthenticatedPrincipal
>>> from zope.principalregistry.principalregistry import UnauthenticatedPrincipal
>>> anonymous = UnauthenticatedPrincipal('anon', '', '')
>>> IUnauthenticatedPrincipal.providedBy(anonymous)
True
When LoginLogout is used for a request that has an unauthenticated principal,
it provides the user with a link to 'Login':
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> request.setPrincipal(anonymous)
>>> LoginLogout(None, request)()
u'[Login]'
Logout, however, behaves differently. Not all authentication protocols (i.e.
credentials extractors/challengers) support 'logout'. Furthermore, we don't
know how an admin may have configured Zope's authentication. Our solution is
to rely on the admin to tell us explicitly that the site supports logout.
By default, the LoginLogout snippet will not provide a logout link for an
unauthenticated principal. To illustrate, we'll first setup a request with an
unauthenticated principal:
>>> from zope.security.interfaces import IPrincipal
>>> from zope.interface import implements
>>> class Bob:
... implements(IPrincipal)
... id = 'bob'
... title = description = ''
>>> bob = Bob()
>>> IUnauthenticatedPrincipal.providedBy(bob)
False
>>> request.setPrincipal(bob)
In this case, the default behavior is to return None for the snippet:
>>> print LoginLogout(None, request)()
None
To show a logout prompt, an admin must register a marker adapter that provides
the interface:
>>> from zope.authentication.interfaces import ILogoutSupported
This flags to LoginLogout that the site supports logout. There is a 'no-op'
adapter that can be registered for this:
>>> from zope.authentication.logout import LogoutSupported
>>> from zope.component import provideAdapter
>>> provideAdapter(LogoutSupported, (None,), ILogoutSupported)
Now when we use LoginLogout with an unauthenticated principal, we get a logout
prompt:
>>> LoginLogout(None, request)()
u'[Logout]'
=======
CHANGES
=======
3.7.5 (2010-01-08)
------------------
- Move 'zope.ManageApplication' permission to zope.app.applicationcontrol
- Fix tests using a newer zope.publisher that requires zope.login.
3.7.3 (2009-11-29)
------------------
- provide a clean zope setup and move zope.app.testing to a test dependency
- removed unused dependencies like ZODB3 etc. from install_requires
3.7.2 (2009-09-10)
------------------
- Added data attribute to '_protections.zcml' for PersistentList
and PersistentDict to accomodate UserList and UserDict behavior
when they are proxied.
3.7.1 (2009-08-15)
------------------
- Changed globalmodules.zcml to avoid making declarations for
deprecated standard modules, to avoid deprecation warnings.
Note that globalmodules.zcml should be avoided. It's better to make
declarations for only what you actually need to use.
3.7.0 (2009-03-14)
------------------
- 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 "global principal registry" along with its zcml directives was moved into
new "zope.principalregistry" 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 as well as some other
common permissions, like "zope.View" have been moved to ``zope.security``.
Its configure.zcml is now included by this package.
- The "protect" function is now a no-op and is not needed anymore, because
zope.security now knows about i18n messages and __name__ and __parent__
attributes and won't protect them by default.
- The addCheckerPublic was moved from zope.app.security.tests to
zope.security.testing. Backward-compatibility import is provided.
- The ``LocalPermission`` class is now moved to new ``zope.app.localpermission``
package. This package now only has backward-compatibility imports and
zcml includes.
- Cleanup dependencies after refactorings. Also, don't depend on
zope.app.testing for tests anymore.
- Update package's description to point about refactorings done.
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 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.
Keywords: zope security authentication principal ftp http
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Framework :: Zope3
zope.app.security-3.7.5/setup.py 0000644 0001750 0001750 00000006035 11321726135 016471 0 ustar faassen faassen ##############################################################################
#
# Copyright (c) Zope Foundation 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.
#
##############################################################################
# This package is developed by the Zope Toolkit project, documented here:
# http://docs.zope.org/zopetoolkit
# When developing and releasing this package, please follow the documented
# Zope Toolkit policies as described by this documentation.
##############################################################################
version = '3.7.5'
import os
from setuptools import setup, find_packages
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(name='zope.app.security',
version = version,
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
description='ZMI Views For Zope3 Security Components',
long_description=(
read('README.txt')
+ '\n\n' +
'Detailed Documentation\n' +
'======================\n'
+ '\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 = "zope security authentication principal ftp http",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope3'],
url='http://pypi.python.org/pypi/zope.app.security',
license='ZPL 2.1',
packages=find_packages('src'),
package_dir = {'': 'src'},
namespace_packages=['zope', 'zope.app'],
extras_require=dict(
test=[
'zope.app.testing',
'zope.testing',
]),
install_requires = [
'setuptools',
'zope.app.localpermission',
'zope.app.pagetemplate',
'zope.app.publisher',
'zope.authentication',
'zope.i18n',
'zope.i18nmessageid',
'zope.interface',
'zope.principalregistry',
'zope.publisher >= 3.12',
'zope.security',
'zope.securitypolicy',
'zope.login',
],
include_package_data = True,
zip_safe = False,
)
zope.app.security-3.7.5/CHANGES.txt 0000644 0001750 0001750 00000012715 11321726135 016572 0 ustar faassen faassen =======
CHANGES
=======
3.7.5 (2010-01-08)
------------------
- Move 'zope.ManageApplication' permission to zope.app.applicationcontrol
- Fix tests using a newer zope.publisher that requires zope.login.
3.7.3 (2009-11-29)
------------------
- provide a clean zope setup and move zope.app.testing to a test dependency
- removed unused dependencies like ZODB3 etc. from install_requires
3.7.2 (2009-09-10)
------------------
- Added data attribute to '_protections.zcml' for PersistentList
and PersistentDict to accomodate UserList and UserDict behavior
when they are proxied.
3.7.1 (2009-08-15)
------------------
- Changed globalmodules.zcml to avoid making declarations for
deprecated standard modules, to avoid deprecation warnings.
Note that globalmodules.zcml should be avoided. It's better to make
declarations for only what you actually need to use.
3.7.0 (2009-03-14)
------------------
- 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 "global principal registry" along with its zcml directives was moved into
new "zope.principalregistry" 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 as well as some other
common permissions, like "zope.View" have been moved to ``zope.security``.
Its configure.zcml is now included by this package.
- The "protect" function is now a no-op and is not needed anymore, because
zope.security now knows about i18n messages and __name__ and __parent__
attributes and won't protect them by default.
- The addCheckerPublic was moved from zope.app.security.tests to
zope.security.testing. Backward-compatibility import is provided.
- The ``LocalPermission`` class is now moved to new ``zope.app.localpermission``
package. This package now only has backward-compatibility imports and
zcml includes.
- Cleanup dependencies after refactorings. Also, don't depend on
zope.app.testing for tests anymore.
- Update package's description to point about refactorings done.
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 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.
zope.app.security-3.7.5/README.txt 0000644 0001750 0001750 00000001453 11321726135 016454 0 ustar faassen faassen This package provides ZMI browser views for Zope security components.
It used to provide a large part of security functionality for Zope 3, but it was
factored out from this package to several little packages to reduce dependencies
and improve reusability.
The functionality was splitted into these new packages:
* zope.authentication - the IAuthentication interface and related utilities.
* zope.principalregistry - the global principal registry and its zcml directives.
* zope.app.localpermission - the LocalPermission class that implements
persistent permissions.
The rest of functionality that were provided by this package is merged into
``zope.security`` and ``zope.publisher``.
Backward-compatibility imports are provided to ensure that older applications
work. See CHANGES.txt for more info.