[Checkins] SVN: zope.authentication/trunk/src/zope/authentication/ Remove things that we won't need for sure.
Dan Korostelev
nadako at gmail.com
Wed Mar 11 17:30:34 EDT 2009
Log message for revision 97920:
Remove things that we won't need for sure.
Changed:
U zope.authentication/trunk/src/zope/authentication/__init__.py
D zope.authentication/trunk/src/zope/authentication/_protections.py
D zope.authentication/trunk/src/zope/authentication/_protections.zcml
U zope.authentication/trunk/src/zope/authentication/browser/__init__.py
D zope.authentication/trunk/src/zope/authentication/browser/auth.py
D zope.authentication/trunk/src/zope/authentication/browser/authutilitysearchview.pt
D zope.authentication/trunk/src/zope/authentication/browser/authutilitysearchview.txt
U zope.authentication/trunk/src/zope/authentication/browser/configure.zcml
D zope.authentication/trunk/src/zope/authentication/browser/localpermission.zcml
D zope.authentication/trunk/src/zope/authentication/browser/login.pt
D zope.authentication/trunk/src/zope/authentication/browser/login_failed.pt
D zope.authentication/trunk/src/zope/authentication/browser/loginlogout.txt
D zope.authentication/trunk/src/zope/authentication/browser/logout.pt
D zope.authentication/trunk/src/zope/authentication/browser/redirect.pt
U zope.authentication/trunk/src/zope/authentication/browser/tests.py
U zope.authentication/trunk/src/zope/authentication/configure.zcml
D zope.authentication/trunk/src/zope/authentication/globalmodules.zcml
D zope.authentication/trunk/src/zope/authentication/globalprincipals.txt
D zope.authentication/trunk/src/zope/authentication/meta.zcml
D zope.authentication/trunk/src/zope/authentication/metaconfigure.py
D zope.authentication/trunk/src/zope/authentication/metadirectives.py
D zope.authentication/trunk/src/zope/authentication/permission.py
D zope.authentication/trunk/src/zope/authentication/principallogging.py
D zope.authentication/trunk/src/zope/authentication/principalregistry.py
D zope.authentication/trunk/src/zope/authentication/protectclass.py
D zope.authentication/trunk/src/zope/authentication/settings.py
U zope.authentication/trunk/src/zope/authentication/vocabulary.py
-=-
Modified: zope.authentication/trunk/src/zope/authentication/__init__.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/__init__.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/__init__.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -19,12 +19,7 @@
from zope.interface import implements, Interface
from zope.app.security import interfaces
-# Register some standard types
-import _protections
-_protections.protect()
-del _protections
-
class LogoutSupported(object):
"""A class that can be registered as an adapter to flag logout support."""
Deleted: zope.authentication/trunk/src/zope/authentication/_protections.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/_protections.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/_protections.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -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.authentication/trunk/src/zope/authentication/_protections.zcml
===================================================================
--- zope.authentication/trunk/src/zope/authentication/_protections.zcml 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/_protections.zcml 2009-03-11 21:30:34 UTC (rev 97920)
@@ -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>
-
Modified: zope.authentication/trunk/src/zope/authentication/browser/__init__.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/__init__.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/__init__.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,17 +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.
-#
-##############################################################################
-"""Security Views
-
-$Id$
-"""
Deleted: zope.authentication/trunk/src/zope/authentication/browser/auth.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/auth.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/auth.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,138 +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.
-#
-##############################################################################
-"""Login and Logout screens
-
-$Id$
-"""
-import urllib
-from zope.interface import implements
-from zope.i18n import translate
-from zope import component
-from zope.app.publisher.interfaces.http import ILogin
-from zope.app.security.i18n import _
-from zope.app.security.interfaces import IAuthentication
-from zope.app.security.interfaces import IUnauthenticatedPrincipal
-from zope.app.security.interfaces import ILogout, ILogoutSupported
-from zope.app.pagetemplate import ViewPageTemplateFile
-
-
-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'<a href="@@login.html?nextURL=%s">%s</a>' % (
- urllib.quote(self.request.getURL()),
- translate(_('[Login]'), context=self.request,
- default='[Login]'))
- elif ILogoutSupported(self.request, None) is not None:
- return u'<a href="@@logout.html?nextURL=%s">%s</a>' % (
- urllib.quote(self.request.getURL()),
- translate(_('[Logout]'), context=self.request,
- default='[Logout]'))
- else:
- return None
Deleted: zope.authentication/trunk/src/zope/authentication/browser/authutilitysearchview.pt
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/authutilitysearchview.pt 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/authutilitysearchview.pt 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,21 +0,0 @@
-<tal:block i18n:domain="zope">
- <h4 tal:content="options/title" i18n:translate="">principals.zcml</h4>
- <div class="row">
- <div class="label" i18n:translate="">
- Search String
- </div>
- <div class="field">
- <input type="text" name="some.searchstring"
- tal:attributes="name string:${options/name}.searchstring"
- />
- </div>
- </div>
- <div class="row">
- <div class="field">
- <input type="submit" name="some.search" value="Search"
- tal:attributes="name string:${options/name}.search"
- i18n:attributes="value search-button"
- />
- </div>
- </div>
-</tal:block>
Deleted: zope.authentication/trunk/src/zope/authentication/browser/authutilitysearchview.txt
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/authutilitysearchview.txt 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/authutilitysearchview.txt 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,68 +0,0 @@
-===========================================
-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
- <h4>principals.zcml</h4>
- <div class="row">
- <div class="label">
- Search String
- </div>
- <div class="field">
- <input type="text" name="test.searchstring" />
- </div>
- </div>
- <div class="row">
- <div class="field">
- <input type="submit" name="test.search" value="Search" />
- </div>
- </div>
-
-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]
Modified: zope.authentication/trunk/src/zope/authentication/browser/configure.zcml
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/configure.zcml 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/configure.zcml 2009-03-11 21:30:34 UTC (rev 97920)
@@ -2,55 +2,11 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
-
<adapter
- for="zope.app.security.interfaces.IAuthentication
- zope.publisher.interfaces.browser.IBrowserRequest"
- provides="zope.app.form.browser.interfaces.ISourceQueryView"
- factory="zope.app.security.browser.auth.AuthUtilitySearchView"
- />
-
- <adapter
for="zope.app.security.interfaces.IPrincipalSource
zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.browser.interfaces.ITerms"
factory="zope.app.security.browser.principalterms.PrincipalTerms"
/>
- <browser:page
- name="failsafelogin.html"
- for="*"
- class=".auth.HTTPBasicAuthenticationLogin"
- attribute="login"
- permission="zope.Public"
- allowed_interface="zope.app.publisher.interfaces.http.ILogin"
- />
-
- <browser:page
- name="login.html"
- for="*"
- class=".auth.HTTPAuthenticationLogin"
- attribute="login"
- permission="zope.Public"
- allowed_interface="zope.app.publisher.interfaces.http.ILogin"
- />
-
- <browser:page
- name="logout.html"
- for="*"
- class=".auth.HTTPAuthenticationLogout"
- attribute="logout"
- permission="zope.Public"
- allowed_interface="zope.app.publisher.interfaces.http.ILogout"
- />
-
- <browser:page
- name="login_logout"
- for="*"
- class=".auth.LoginLogout"
- permission="zope.Public"
- />
-
- <include file="localpermission.zcml" />
-
</configure>
Deleted: zope.authentication/trunk/src/zope/authentication/browser/localpermission.zcml
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/localpermission.zcml 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/localpermission.zcml 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,29 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser">
-
- <browser:addform
- name="AddPermission.html"
- schema="zope.security.interfaces.IPermission"
- label="Add Permission"
- content_factory="..permission.LocalPermission"
- fields="title description"
- permission="zope.Security"
- />
-
- <browser:addMenuItem
- title="Permission"
- description="A Security Permission"
- class="..permission.LocalPermission"
- permission="zope.ManageServices"
- view="AddPermission.html"
- />
-
- <browser:editform
- schema="zope.security.interfaces.IPermission"
- label="Edit Permission"
- name="edit.html"
- permission="zope.ManageServices"
- menu="zmi_views" title="Edit" />
-
-</configure>
Deleted: zope.authentication/trunk/src/zope/authentication/browser/login.pt
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/login.pt 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/login.pt 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,19 +0,0 @@
-<html metal:use-macro="context/@@standard_macros/page"
- i18n:domain="zope">
- <body>
- <div metal:fill-slot="body">
-
- <h1 i18n:translate="">Login successful!</h1>
-
- <p style="font-size: 200%" i18n:translate="">
- You are now logged in as
- <em tal:content="view/request/principal/title"
- i18n:name="UserTitle">Joe Smith</em>.
- </p>
-
- <a href="." i18n:translate="">Back to the main page.</a>
-
- </div>
- </body>
-
-</html>
Deleted: zope.authentication/trunk/src/zope/authentication/browser/login_failed.pt
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/login_failed.pt 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/login_failed.pt 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,18 +0,0 @@
-<html metal:use-macro="context/@@standard_macros/page"
- i18n:domain="zope">
- <body>
- <div metal:fill-slot="body">
-
- <h1 i18n:translate="">Login Failed!</h1>
-
- <p style="font-size: 150%">
- <tal:block
- i18n:translate="">You cancelled the login procedure.</tal:block>
- <a tal:attributes="href python: view.request.get('nextURL', '.')"
- i18n:translate="">Click here to return.</a>
- </p>
-
- </div>
- </body>
-
-</html>
Deleted: zope.authentication/trunk/src/zope/authentication/browser/loginlogout.txt
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/loginlogout.txt 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/loginlogout.txt 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,71 +0,0 @@
-====================
-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.app.security.interfaces import IUnauthenticatedPrincipal
- >>> from zope.app.security.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'<a href="@@login.html?nextURL=http%3A//127.0.0.1">[Login]</a>'
-
-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.app.security.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.app.security import LogoutSupported
- >>> from zope.app.testing import ztapi
- >>> ztapi.provideAdapter(None, ILogoutSupported, LogoutSupported)
-
-Now when we use LoginLogout with an unauthenticated principal, we get a logout
-prompt:
-
- >>> LoginLogout(None, request)()
- u'<a href="@@logout.html?nextURL=http%3A//127.0.0.1">[Logout]</a>'
Deleted: zope.authentication/trunk/src/zope/authentication/browser/logout.pt
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/logout.pt 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/logout.pt 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,37 +0,0 @@
-<html metal:use-macro="context/@@standard_macros/page"
- i18n:domain="zope">
- <head>
- <metal:block fill-slot="headers">
- <script type="text/javascript"><!--
- // clear HTTP Authentication
- try {
- if (window.XMLHttpRequest) {
- var xmlhttp = new XMLHttpRequest();
- // Send invalid credentials, then abort
- xmlhttp.open("GET", "@@", true, "logout", "logout");
- xmlhttp.send("");
- xmlhttp.abort();
- } else if (document.execCommand) {
- // IE specific command
- document.execCommand("ClearAuthenticationCache");
- }
- } catch(e) { }
- //-->
- </script>
- </metal:block>
- </head>
- <body>
- <div metal:fill-slot="body">
-
- <h1 i18n:translate="">Logout successful!</h1>
-
- <p style="font-size: 200%" i18n:translate="">
- You are now logged out.
- </p>
-
- <a href="." i18n:translate="">Back to the main page.</a>
-
- </div>
- </body>
-
-</html>
Deleted: zope.authentication/trunk/src/zope/authentication/browser/redirect.pt
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/redirect.pt 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/redirect.pt 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,39 +0,0 @@
-<html metal:use-macro="context/@@standard_macros/page"
- i18n:domain="zope">
- <head>
- <metal:block fill-slot="headers">
- <meta http-equiv="refresh" content="0;url=./"
- tal:attributes="content string:0;;url=${view/request/nextURL}" />
- <script type="text/javascript"><!--
- // clear HTTP Authentication
- try {
- if (window.XMLHttpRequest) {
- var xmlhttp = new XMLHttpRequest();
- // Send invalid credentials, then abort
- xmlhttp.open("GET", "@@", true, "logout", "logout");
- xmlhttp.send("");
- xmlhttp.abort();
- } else if (document.execCommand) {
- // IE specific command
- document.execCommand("ClearAuthenticationCache");
- }
- } catch(e) { }
- //-->
- </script>
- </metal:block>
- </head>
- <body>
- <div metal:fill-slot="body">
-
- <h1 i18n:translate="">You are being redirected!</h1>
-
- <p style="font-size: 150%">
- <a tal:attributes="href view/request/nextURL" i18n:translate="">
- If you see this screen for more than 5 seconds, click here.
- </a>
- </p>
-
- </div>
- </body>
-
-</html>
Modified: zope.authentication/trunk/src/zope/authentication/browser/tests.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/browser/tests.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/browser/tests.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -22,15 +22,9 @@
def test_suite():
return unittest.TestSuite((
- doctest.DocFileSuite('authutilitysearchview.txt',
- setUp=placelesssetup.setUp,
- tearDown=placelesssetup.tearDown),
doctest.DocFileSuite('principalterms.txt',
setUp=placelesssetup.setUp,
tearDown=placelesssetup.tearDown),
- doctest.DocFileSuite('loginlogout.txt',
- setUp=placelesssetup.setUp,
- tearDown=placelesssetup.tearDown),
))
if __name__ == '__main__':
Modified: zope.authentication/trunk/src/zope/authentication/configure.zcml
===================================================================
--- zope.authentication/trunk/src/zope/authentication/configure.zcml 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/configure.zcml 2009-03-11 21:30:34 UTC (rev 97920)
@@ -3,82 +3,8 @@
i18n_domain="zope"
>
- <include package="zope.security" />
- <include package="zope.localpermission" />
-
- <include file="globalmodules.zcml" />
- <include file="_protections.zcml" />
-
- <utility
- provides=".interfaces.IAuthentication"
- component=".principalregistry.principalRegistry"
- />
-
-
- <class class="zope.security.permission.Permission">
- <allow
- interface="zope.security.interfaces.IPermission"
- />
- </class>
-
- <class class=".principalregistry.Principal">
- <allow
- interface=".interfaces.IPrincipal"
- />
- </class>
-
<adapter factory=".NoLogout" />
- <!-- 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."
- />
-
<adapter
factory=".basicauthadapter.BasicAuthAdapter"
provides=".interfaces.ILoginPassword"
Deleted: zope.authentication/trunk/src/zope/authentication/globalmodules.zcml
===================================================================
--- zope.authentication/trunk/src/zope/authentication/globalmodules.zcml 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/globalmodules.zcml 2009-03-11 21:30:34 UTC (rev 97920)
@@ -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.authentication/trunk/src/zope/authentication/globalprincipals.txt
===================================================================
--- zope.authentication/trunk/src/zope/authentication/globalprincipals.txt 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/globalprincipals.txt 2009-03-11 21:30:34 UTC (rev 97920)
@@ -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.authentication/trunk/src/zope/authentication/meta.zcml
===================================================================
--- zope.authentication/trunk/src/zope/authentication/meta.zcml 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/meta.zcml 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,37 +0,0 @@
-<configure
- 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"
- schema=".metadirectives.IDefinePrincipalDirective"
- handler=".metaconfigure.principal" />
-
- <meta:directive
- name="unauthenticatedPrincipal"
- namespace="http://namespaces.zope.org/zope"
- schema=".metadirectives.IDefineUnauthenticatedPrincipalDirective"
- handler=".metaconfigure.unauthenticatedPrincipal" />
-
- <meta:directive
- name="unauthenticatedGroup"
- namespace="http://namespaces.zope.org/zope"
- schema=".metadirectives.IDefineUnauthenticatedGroupDirective"
- handler=".metaconfigure.unauthenticatedGroup" />
-
- <meta:directive
- name="authenticatedGroup"
- namespace="http://namespaces.zope.org/zope"
- schema=".metadirectives.IDefineAuthenticatedGroupDirective"
- handler=".metaconfigure.authenticatedGroup" />
-
- <meta:directive
- name="everybodyGroup"
- namespace="http://namespaces.zope.org/zope"
- schema=".metadirectives.IDefineEverybodyGroupDirective"
- handler=".metaconfigure.everybodyGroup" />
-
-</configure>
Deleted: zope.authentication/trunk/src/zope/authentication/metaconfigure.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/metaconfigure.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/metaconfigure.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,129 +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 security related configuration directives.
-
-$Id$
-"""
-from zope import component
-from zope.component.zcml import utility
-
-from zope.app.security import principalregistry
-from zope.app.security import interfaces
-
-
-def _principal():
- group = component.queryUtility(interfaces.IAuthenticatedGroup)
- if group is not None:
- _authenticatedGroup(group.id)
- group = component.queryUtility(interfaces.IEveryoneGroup)
- if group is not None:
- _everybodyGroup(group.id)
-
-def principal(_context, id, title, login,
- password, description='', password_manager="Plain Text"):
- _context.action(
- discriminator = ('principal', id),
- callable = principalregistry.principalRegistry.definePrincipal,
- args = (id, title, description, login, password, password_manager) )
- _context.action(discriminator = None, callable = _principal, args = ())
-
-
-def _unauthenticatedPrincipal():
- group = component.queryUtility(interfaces.IUnauthenticatedGroup)
- if group is not None:
- _unauthenticatedGroup(group.id)
- group = component.queryUtility(interfaces.IEveryoneGroup)
- if group is not None:
- _everybodyGroup(group.id)
-
-def unauthenticatedPrincipal(_context, id, title, description=''):
- principal = principalregistry.UnauthenticatedPrincipal(
- id, title, description)
- _context.action(
- discriminator = 'unauthenticatedPrincipal',
- callable = principalregistry.principalRegistry.defineDefaultPrincipal,
- args = (id, title, description, principal) )
- utility(_context, interfaces.IUnauthenticatedPrincipal, principal)
- _context.action(
- discriminator = None,
- callable = _unauthenticatedPrincipal,
- args = (),
- )
-
-def _unauthenticatedGroup(group):
- p = principalregistry.principalRegistry.unauthenticatedPrincipal()
- if p is not None:
- p.groups.append(group)
-
-def unauthenticatedGroup(_context, id, title, description=''):
- principal = principalregistry.UnauthenticatedGroup(
- id, title, description)
- utility(_context, interfaces.IUnauthenticatedGroup, principal)
- _context.action(
- discriminator = None,
- callable = _unauthenticatedGroup,
- args = (principal.id, ),
- )
- _context.action(
- discriminator = None,
- callable = principalregistry.principalRegistry.registerGroup,
- args = (principal, ),
- )
-
-def _authenticatedGroup(group):
- for p in principalregistry.principalRegistry.getPrincipals(''):
- if not isinstance(p, principalregistry.Principal):
- continue
- if group not in p.groups:
- p.groups.append(group)
-
-def authenticatedGroup(_context, id, title, description=''):
- principal = principalregistry.AuthenticatedGroup(
- id, title, description)
- utility(_context, interfaces.IAuthenticatedGroup, principal)
- _context.action(
- discriminator = None,
- callable = _authenticatedGroup,
- args = (principal.id, ),
- )
- _context.action(
- discriminator = None,
- callable = principalregistry.principalRegistry.registerGroup,
- args = (principal, ),
- )
-
-def _everybodyGroup(group):
- for p in principalregistry.principalRegistry.getPrincipals(''):
- if not isinstance(p, principalregistry.Principal):
- continue
- if group not in p.groups:
- p.groups.append(group)
- p = principalregistry.principalRegistry.unauthenticatedPrincipal()
- if p is not None:
- p.groups.append(group)
-
-def everybodyGroup(_context, id, title, description=''):
- principal = principalregistry.EverybodyGroup(
- id, title, description)
- utility(_context, interfaces.IEveryoneGroup, principal)
- _context.action(
- discriminator = None,
- callable = _everybodyGroup,
- args = (principal.id, ),
- )
- _context.action(
- discriminator = None,
- callable = principalregistry.principalRegistry.registerGroup,
- args = (principal, ),
- )
Deleted: zope.authentication/trunk/src/zope/authentication/metadirectives.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/metadirectives.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/metadirectives.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,70 +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.
-#
-##############################################################################
-"""securityPolicy Directive Schema
-
-$Id$
-"""
-from zope.interface import Interface
-from zope.schema import Id, TextLine
-
-
-class IBasePrincipalDirective(Interface):
- """Base interface for principal definition directives."""
-
- id = Id(
- title=u"Id",
- description=u"Id as which this object will be known and used.",
- required=True)
-
- title = TextLine(
- title=u"Title",
- description=u"Provides a title for the object.",
- required=True)
-
- description = TextLine(
- title=u"Title",
- description=u"Provides a description for the object.",
- required=False)
-
-class IDefinePrincipalDirective(IBasePrincipalDirective):
- """Define a new principal."""
-
- login = TextLine(
- title=u"Username/Login",
- description=u"Specifies the Principal's Username/Login.",
- required=True)
-
- password = TextLine(
- title=u"Password",
- description=u"Specifies the Principal's Password.",
- required=True)
-
- password_manager = TextLine(
- title=u"Password Manager Name",
- description=(u"Name of the password manager will be used"
- " for encode/check the password"),
- default=u"Plain Text"
- )
-
-class IDefineUnauthenticatedPrincipalDirective(IBasePrincipalDirective):
- """Define a new unauthenticated principal."""
-
-class IDefineUnauthenticatedGroupDirective(IBasePrincipalDirective):
- """Define the unauthenticated group."""
-
-class IDefineAuthenticatedGroupDirective(IBasePrincipalDirective):
- """Define the authenticated group."""
-
-class IDefineEverybodyGroupDirective(IBasePrincipalDirective):
- """Define the everybody group."""
Deleted: zope.authentication/trunk/src/zope/authentication/permission.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/permission.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/permission.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -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.authentication/trunk/src/zope/authentication/principallogging.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/principallogging.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/principallogging.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -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
Deleted: zope.authentication/trunk/src/zope/authentication/principalregistry.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/principalregistry.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/principalregistry.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -1,204 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Global Authentication Utility or Principal Registry
-
-$Id$
-"""
-from zope.component import getUtility
-from zope.interface import implements
-from zope.container.contained import Contained, contained
-
-import zope.security.management
-from zope.security.interfaces import IGroupAwarePrincipal
-from zope.password.interfaces import IPasswordManager
-
-from zope.app.security import interfaces
-
-
-class DuplicateLogin(Exception):
- pass
-
-class DuplicateId(Exception):
- pass
-
-class PrincipalRegistry(object):
-
- implements(interfaces.IAuthentication, interfaces.ILogout)
-
- # Methods implementing IAuthentication
-
- def authenticate(self, request):
- a = interfaces.ILoginPassword(request, None)
- if a is not None:
- login = a.getLogin()
- if login is not None:
- p = self.__principalsByLogin.get(login, None)
- if p is not None:
- password = a.getPassword()
- if p.validate(password):
- return p
- return None
-
- __defaultid = None
- __defaultObject = None
-
- def defineDefaultPrincipal(self, id, title, description='',
- principal=None):
- if id in self.__principalsById:
- raise DuplicateId(id)
- self.__defaultid = id
- if principal is None:
- principal = UnauthenticatedPrincipal(id, title, description)
- self.__defaultObject = contained(principal, self, id)
- return principal
-
- def unauthenticatedPrincipal(self):
- return self.__defaultObject
-
- def unauthorized(self, id, request):
- if id is None or id is self.__defaultid:
- a = interfaces.ILoginPassword(request)
- a.needLogin(realm="Zope")
-
- def getPrincipal(self, id):
- r = self.__principalsById.get(id)
- if r is None:
- if id == self.__defaultid:
- return self.__defaultObject
- if id == zope.security.management.system_user.id:
- return zope.security.management.system_user
- raise interfaces.PrincipalLookupError(id)
- return r
-
- def getPrincipalByLogin(self, login):
- return self.__principalsByLogin[login]
-
- def getPrincipals(self, name):
- name = name.lower()
- return [p for p in self.__principalsById.itervalues()
- if p.title.lower().startswith(name) or
- p.getLogin().lower().startswith(name)]
-
- def logout(self, request):
- # not supporting basic auth logout -- no such thing
- pass
-
- # Management methods
-
- def __init__(self):
- self.__principalsById = {}
- self.__principalsByLogin = {}
-
- def definePrincipal(self, principal, title, description='',
- login='', password='', passwordManagerName='Plain Text'):
- id=principal
- if login in self.__principalsByLogin:
- raise DuplicateLogin(login)
-
- if id in self.__principalsById or id == self.__defaultid:
- raise DuplicateId(id)
-
- p = Principal(id, title, description,
- login, password, passwordManagerName)
- p = contained(p, self, id)
-
- self.__principalsByLogin[login] = p
- self.__principalsById[id] = p
-
- return p
-
- def registerGroup(self, group):
- id = group.id
- if id in self.__principalsById or id == self.__defaultid:
- raise DuplicateId(id)
-
- self.__principalsById[group.id] = group
-
- def _clear(self):
- self.__init__()
- self.__defaultid = None
- self.__defaultObject = None
-
-principalRegistry = PrincipalRegistry()
-
-# Register our cleanup with Testing.CleanUp to make writing unit tests
-# simpler.
-try:
- from zope.testing.cleanup import addCleanUp
-except ImportError:
- pass
-else:
- addCleanUp(principalRegistry._clear)
- del addCleanUp
-
-class PrincipalBase(Contained):
-
- def __init__(self, id, title, description):
- self.id = id
- self.title = title
- self.description = description
- self.groups = []
-
-class Group(PrincipalBase):
-
- def getLogin(self):
- return '' # to make registry search happy
-
-class Principal(PrincipalBase):
-
- implements(IGroupAwarePrincipal)
-
- def __init__(self, id, title, description, login,
- pw, pwManagerName="Plain Text"):
- super(Principal, self).__init__(id, title, description)
- self.__login = login
- self.__pwManagerName = pwManagerName
- self.__pw = pw
-
- def __getPasswordManager(self):
- return getUtility(IPasswordManager, self.__pwManagerName)
-
- def getLogin(self):
- return self.__login
-
- def validate(self, pw):
- pwManager = self.__getPasswordManager()
- return pwManager.checkPassword(self.__pw, pw)
-
-
-class UnauthenticatedPrincipal(PrincipalBase):
-
- implements(interfaces.IUnauthenticatedPrincipal)
-
-
-fallback_unauthenticated_principal = (
- UnauthenticatedPrincipal(
- __name__+'.fallback_unauthenticated_principal',
- 'Fallback unauthenticated principal',
- 'The default unauthenticated principal. Used as a fallback to '
- 'allow challenging for a user even if the IAuthentication returned '
- 'None as the unauthenticated principal.'))
-
-
-class UnauthenticatedGroup(Group):
-
- implements(interfaces.IUnauthenticatedGroup)
-
-class AuthenticatedGroup(Group):
-
- implements(interfaces.IAuthenticatedGroup)
-
-class EverybodyGroup(Group):
-
- implements(interfaces.IEveryoneGroup)
Deleted: zope.authentication/trunk/src/zope/authentication/protectclass.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/protectclass.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/protectclass.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -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.authentication/trunk/src/zope/authentication/settings.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/settings.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/settings.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -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.authentication/trunk/src/zope/authentication/vocabulary.py
===================================================================
--- zope.authentication/trunk/src/zope/authentication/vocabulary.py 2009-03-11 21:25:10 UTC (rev 97919)
+++ zope.authentication/trunk/src/zope/authentication/vocabulary.py 2009-03-11 21:30:34 UTC (rev 97920)
@@ -28,11 +28,7 @@
from zope.app.security.interfaces import IPrincipalSource
from zope.app.security.interfaces import PrincipalLookupError
-# BBB: these vocabularies are moved to zope.security.
-from zope.security.permission import PermissionsVocabulary
-from zope.security.permission import PermissionIdsVocabulary
-
class PrincipalSource(object):
"""Generic Principal Source"""
implements(IPrincipalSource, ISourceQueriables)
More information about the Checkins
mailing list