[Zope3-checkins] SVN: Zope3/branches/mgedmin-security/src/zope/
Made BaseRequest an IParticipation and replaced request.user with
Marius Gedminas
marius at pov.lt
Wed May 12 16:00:41 EDT 2004
Log message for revision 24604:
Made BaseRequest an IParticipation and replaced request.user with
request.principal everywhere.
-=-
Modified: Zope3/branches/mgedmin-security/src/zope/app/basicskin/view_macros.pt
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/basicskin/view_macros.pt 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/basicskin/view_macros.pt 2004-05-12 20:00:38 UTC (rev 24604)
@@ -32,7 +32,8 @@
<div metal:define-macro="logged_user">
<p i18n:translate="">User:
- <span tal:replace="request/user/title" i18n:name="user_title">User</span>
+ <span tal:replace="request/principal/title"
+ i18n:name="user_title">User</span>
</p>
</div>
Modified: Zope3/branches/mgedmin-security/src/zope/app/container/browser/contents.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/container/browser/contents.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/container/browser/contents.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -246,7 +246,7 @@
container_path = zapi.getPath(self.context)
- user = self.request.user
+ user = self.request.principal
annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
annotations = annotationsvc.getAnnotations(user)
clipboard = IPrincipalClipboard(annotations)
@@ -266,7 +266,7 @@
container_path = zapi.getPath(self.context)
- user = self.request.user
+ user = self.request.principal
annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
annotations = annotationsvc.getAnnotations(user)
clipboard = IPrincipalClipboard(annotations)
@@ -281,7 +281,7 @@
"""Decide if there is anything to paste
"""
target = self.context
- user = self.request.user
+ user = self.request.principal
annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
annotations = annotationsvc.getAnnotations(user)
clipboard = IPrincipalClipboard(annotations)
@@ -310,7 +310,7 @@
"""Paste ojects in the user clipboard to the container
"""
target = self.context
- user = self.request.user
+ user = self.request.principal
annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
annotations = annotationsvc.getAnnotations(user)
clipboard = IPrincipalClipboard(annotations)
@@ -344,7 +344,7 @@
if not self.supportsPaste:
return False
- user = self.request.user
+ user = self.request.principal
annotationsvc = zapi.getService(self.context, 'PrincipalAnnotation')
annotations = annotationsvc.getAnnotations(user)
Modified: Zope3/branches/mgedmin-security/src/zope/app/container/browser/tests/test_contents.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/container/browser/tests/test_contents.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/container/browser/tests/test_contents.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -280,7 +280,7 @@
from zope.app.container.browser.contents import Contents
from zope.publisher.browser import TestRequest
request = TestRequest()
- request.setUser(Principal())
+ request.setPrincipal(Principal())
return Contents(container, request)
class Test(BaseTestContentsBrowserView, TestCase):
@@ -296,7 +296,7 @@
from zope.app.container.browser.contents import Contents
from zope.publisher.browser import TestRequest
request = TestRequest()
- request.setUser(Principal())
+ request.setPrincipal(Principal())
return Contents(container, request)
def test_suite():
Modified: Zope3/branches/mgedmin-security/src/zope/app/errorservice/__init__.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/errorservice/__init__.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/errorservice/__init__.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -104,18 +104,18 @@
url = request.URL
try:
# XXX: UnauthenticatedPrincipal does not have getLogin()
- if hasattr(request.user, 'getLogin'):
- login = request.user.getLogin()
+ if hasattr(request.principal, 'getLogin'):
+ login = request.principal.getLogin()
else:
login = 'unauthenticated'
username = ', '.join(map(str, (login,
- request.user.id,
- request.user.title,
- request.user.description
+ request.principal.id,
+ request.principal.title,
+ request.principal.description
)))
- # When there's an unauthorized access, request.user is
+ # When there's an unauthorized access, request.principal is
# not set, so we get an AttributeError
- # XXX is this right? Surely request.user should be set!
+ # XXX is this right? Surely request.principal should be set!
# XXX Answer: Catching AttributeError is correct for the
# simple reason that UnauthenticatedUser (which
# I always use during coding), has no 'getLogin()'
Modified: Zope3/branches/mgedmin-security/src/zope/app/exception/browser/tests/test_unauthorized.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/exception/browser/tests/test_unauthorized.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/exception/browser/tests/test_unauthorized.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -60,7 +60,7 @@
pass
request = TestRequest('/')
authservice = DummyAuthService()
- request.setUser(contained(DummyPrincipal(23), authservice))
+ request.setPrincipal(contained(DummyPrincipal(23), authservice))
u = Unauthorized(exception, request)
u.issueChallenge()
@@ -81,7 +81,7 @@
authservice = DummyAuthService()
psrc = DummyPrincipalSource()
psrc = contained(psrc, authservice)
- request.setUser(contained(DummyPrincipal(23), psrc))
+ request.setPrincipal(contained(DummyPrincipal(23), psrc))
u = Unauthorized(exception, request)
u.issueChallenge()
Modified: Zope3/branches/mgedmin-security/src/zope/app/exception/browser/unauthorized.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/exception/browser/unauthorized.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/exception/browser/unauthorized.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -25,7 +25,7 @@
# Set the error status to 403 (Forbidden) in the case when we don't
# challenge the user
self.request.response.setStatus(403)
- principal = self.request.user
+ principal = self.request.principal
prinreg = zapi.getParent(principal)
if not IAuthenticationService.providedBy(prinreg):
# With PluggableAuthenticationService, principals are
Modified: Zope3/branches/mgedmin-security/src/zope/app/onlinehelp/browser/skin/view_macros.pt
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/onlinehelp/browser/skin/view_macros.pt 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/onlinehelp/browser/skin/view_macros.pt 2004-05-12 20:00:38 UTC (rev 24604)
@@ -25,7 +25,7 @@
<div metal:define-macro="logged_user">
<p i18n:translate="">
User:
- <span tal:replace="request/user/title"
+ <span tal:replace="request/principal/title"
i18n:name="user_title">User</span>
</p>
</div>
Modified: Zope3/branches/mgedmin-security/src/zope/app/publication/tests/test_browserpublication.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/publication/tests/test_browserpublication.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/publication/tests/test_browserpublication.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -280,7 +280,7 @@
# With a normal request, we should get a body:
output = StringIO()
request = TestRequest(StringIO(''), output, {'PATH_INFO': '/'})
- request.setUser(User())
+ request.setPrincipal(User())
request.response.setBody("spam")
pub.afterCall(request, None)
request.response.outputBody()
@@ -296,7 +296,7 @@
# But with a HEAD request, the body should be empty
output = StringIO()
request = TestRequest(StringIO(''), output, {'PATH_INFO': '/'})
- request.setUser(User())
+ request.setPrincipal(User())
request.method = 'HEAD'
request.response.setBody("spam")
pub.afterCall(request, None)
Modified: Zope3/branches/mgedmin-security/src/zope/app/publication/tests/test_zopepublication.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/publication/tests/test_zopepublication.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/publication/tests/test_zopepublication.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -139,7 +139,7 @@
self.out = StringIO()
self.request = TestRequest('/f1/f2', outstream=self.out)
self.user = Principal('test.principal')
- self.request.setUser(self.user)
+ self.request.setPrincipal(self.user)
from zope.interface import Interface
self.presentation_type = Interface
self.request._presentation_type = self.presentation_type
@@ -371,19 +371,19 @@
self.publication.beforeTraversal(self.request)
user = getSecurityManager().getPrincipal()
- self.assertEqual(user, self.request.user)
- self.assertEqual(self.request.user.id, 'anonymous')
+ self.assertEqual(user, self.request.principal)
+ self.assertEqual(self.request.principal.id, 'anonymous')
root = self.publication.getApplication(self.request)
self.publication.callTraversalHooks(self.request, root)
- self.assertEqual(self.request.user.id, 'anonymous')
+ self.assertEqual(self.request.principal.id, 'anonymous')
ob = self.publication.traverseName(self.request, root, 'f1')
self.publication.callTraversalHooks(self.request, ob)
- self.assertEqual(self.request.user.id, 'test.anonymous')
+ self.assertEqual(self.request.principal.id, 'test.anonymous')
ob = self.publication.traverseName(self.request, ob, 'f2')
self.publication.afterTraversal(self.request, ob)
- self.assertEqual(self.request.user.id, 'test.bob')
+ self.assertEqual(self.request.principal.id, 'test.bob')
user = getSecurityManager().getPrincipal()
- self.assertEqual(user, self.request.user)
+ self.assertEqual(user, self.request.principal)
def testTransactionCommitAfterCall(self):
root = self.db.open().root()
Modified: Zope3/branches/mgedmin-security/src/zope/app/publication/zopepublication.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/publication/zopepublication.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/publication/zopepublication.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -72,12 +72,12 @@
if p is None:
raise Unauthorized # If there's no default principal
- request.setUser(p)
- newSecurityManager(request.user)
+ request.setPrincipal(p)
+ newSecurityManager(request.principal)
get_transaction().begin()
def _maybePlacefullyAuthenticate(self, request, ob):
- if not IUnauthenticatedPrincipal.providedBy(request.user):
+ if not IUnauthenticatedPrincipal.providedBy(request.principal):
# We've already got an authenticated user. There's nothing to do.
# Note that beforeTraversal guarentees that user is not None.
return
@@ -101,8 +101,8 @@
# nothing to do here
return
- request.setUser(principal)
- newSecurityManager(request.user)
+ request.setPrincipal(principal)
+ newSecurityManager(request.principal)
def callTraversalHooks(self, request, ob):
@@ -161,7 +161,7 @@
This method is not part of the IPublication interface, since
it's specific to this particular implementation.
"""
- txn.setUser(request.user.id)
+ txn.setUser(request.principal.id)
# Work around methods that are usually used for views
bare = trustedRemoveSecurityProxy(ob)
Modified: Zope3/branches/mgedmin-security/src/zope/app/rotterdam/dialog_macros.pt
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/rotterdam/dialog_macros.pt 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/rotterdam/dialog_macros.pt 2004-05-12 20:00:38 UTC (rev 24604)
@@ -49,7 +49,7 @@
<metal:block define-macro="logged_user">
<span tal:omit-tag="" i18n:translate="">User:</span>
- <tal:block replace="request/user/title">
+ <tal:block replace="request/principal/title">
User
</tal:block>
</metal:block>
Modified: Zope3/branches/mgedmin-security/src/zope/app/rotterdam/template.pt
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/rotterdam/template.pt 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/rotterdam/template.pt 2004-05-12 20:00:38 UTC (rev 24604)
@@ -44,18 +44,18 @@
<div id="userDetails">
<metal:block define-macro="logged_user">
<span tal:omit-tag="" i18n:translate="">User:</span>
- <tal:block replace="request/user/title">
+ <tal:block replace="request/principal/title">
User
</tal:block>
</metal:block>
<a href=""
tal:attributes="href string:@@logout.html?nextURL=${request/URL}"
- tal:condition="python: hasattr(request.user, 'getLogin')"
+ tal:condition="python: hasattr(request.principal, 'getLogin')"
i18n:translate="">
[Logout]</a>
<a href=""
tal:attributes="href string:@@login.html?nextURL=${request/URL}"
- tal:condition="python: not hasattr(request.user, 'getLogin')"
+ tal:condition="python: not hasattr(request.principal, 'getLogin')"
i18n:translate="">
[Login]</a>
</div>
Modified: Zope3/branches/mgedmin-security/src/zope/app/rotterdam/view_macros.pt
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/rotterdam/view_macros.pt 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/rotterdam/view_macros.pt 2004-05-12 20:00:38 UTC (rev 24604)
@@ -33,7 +33,7 @@
<div metal:define-macro="logged_user">
<p i18n:translate="">User:
- <span tal:replace="request/user/title">User</span>
+ <span tal:replace="request/principal/title">User</span>
</p>
</div>
Modified: Zope3/branches/mgedmin-security/src/zope/app/security/browser/auth.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/security/browser/auth.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/security/browser/auth.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -26,7 +26,7 @@
def login(self, nextURL=None):
"""See zope.app.security.interfaces.ILogin"""
- if isinstance(removeAllProxies(self.request.user), \
+ if isinstance(removeAllProxies(self.request.principal), \
UnauthenticatedPrincipal):
self.request.unauthorized("basic realm='Zope'")
return self.failed()
@@ -53,7 +53,7 @@
def logout(self, nextURL=None):
"""See zope.app.security.interfaces.ILogout"""
- if not isinstance(self.request.user, UnauthenticatedPrincipal):
+ if not isinstance(self.request.principal, UnauthenticatedPrincipal):
self.request.unauthorized("basic realm='Zope'")
if nextURL:
return self.redirect()
Modified: Zope3/branches/mgedmin-security/src/zope/app/security/browser/login.pt
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/security/browser/login.pt 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/security/browser/login.pt 2004-05-12 20:00:38 UTC (rev 24604)
@@ -6,7 +6,7 @@
<p style="font-size: 200%" i18n:translate="">
You are now logged in as
- <em tal:content="view/request/user/title"
+ <em tal:content="view/request/principal/title"
i18n:name="UserTitle">Joe Smith</em>.
</p>
Modified: Zope3/branches/mgedmin-security/src/zope/app/undo/browser.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/undo/browser.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/undo/browser.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -30,7 +30,8 @@
"""
request = self.request
undo = zapi.getUtility(self.context, IUndoManager)
- txn_info = undo.getPrincipalTransactions(request.user, first=0, last=1)
+ txn_info = undo.getPrincipalTransactions(request.principal, first=0,
+ last=1)
if txn_info:
return txn_info[0].get('undo', False)
return False
@@ -40,10 +41,11 @@
return where he/she came from"""
request = self.request
undo = zapi.getUtility(self.context, IUndoManager)
- txn_info = undo.getPrincipalTransactions(request.user, first=0, last=1)
+ txn_info = undo.getPrincipalTransactions(request.principal, first=0,
+ last=1)
if txn_info:
id = txn_info[0]['id']
- undo.undoPrincipalTransactions(request.user, [id])
+ undo.undoPrincipalTransactions(request.principal, [id])
target = request.get('HTTP_REFERER', '@@SelectedManagementView.html')
request.response.redirect(target)
@@ -57,7 +59,7 @@
"""Undo transactions that were issued by the authenticated
user specified in 'ids'."""
undo = zapi.getUtility(self.context, IUndoManager)
- undo.undoPrincipalTransactions(self.request.user, ids)
+ undo.undoPrincipalTransactions(self.request.principal, ids)
self._redirect()
def _redirect(self):
@@ -76,5 +78,5 @@
if not showall:
context = self.context
undo = zapi.getUtility(self.context, IUndoManager)
- return undo.getPrincipalTransactions(self.request.user, context,
+ return undo.getPrincipalTransactions(self.request.principal, context,
first, last)
Modified: Zope3/branches/mgedmin-security/src/zope/app/undo/tests/test_undoview.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/undo/tests/test_undoview.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/undo/tests/test_undoview.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -63,7 +63,7 @@
return list[first:abs(last)]
def _emulatePublication(self, request):
- self._user_name = request.user.id
+ self._user_name = request.principal.id
def undoTransactions(self, ids):
# just remove an element for now
@@ -96,7 +96,7 @@
def testPrincipalLastTransactionIsUndo(self):
request = self.request
bonobo = principalRegistry.getPrincipal('bonobo')
- request.setUser(bonobo)
+ request.setPrincipal(bonobo)
view = UndoView(self.folder1, request)
self.failIf(view.principalLastTransactionIsUndo())
@@ -110,7 +110,7 @@
def testUndoPrincipalLastTransaction(self):
request = self.request
bonobo = principalRegistry.getPrincipal('bonobo')
- request.setUser(bonobo)
+ request.setPrincipal(bonobo)
self.undo._emulatePublication(request)
view = UndoView(self.folder1, request)
@@ -135,7 +135,7 @@
def testGetPrincipalTransactions(self):
request = self.request
bonobo = principalRegistry.getPrincipal('bonobo')
- request.setUser(bonobo)
+ request.setPrincipal(bonobo)
view = UndoView(self.folder1, request)
expected = self.undo.getPrincipalTransactions(bonobo)
@@ -152,7 +152,7 @@
def testUndoPrincipalTransactions(self):
request = self.request
bonobo = principalRegistry.getPrincipal('bonobo')
- request.setUser(bonobo)
+ request.setPrincipal(bonobo)
view = UndoView(self.folder1, request)
# Just test whether it accepts the principal. We know that
Modified: Zope3/branches/mgedmin-security/src/zope/app/wiki/browser/skin/template.pt
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/wiki/browser/skin/template.pt 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/wiki/browser/skin/template.pt 2004-05-12 20:00:38 UTC (rev 24604)
@@ -68,9 +68,9 @@
<div id="personal" i18n:translate="">
User:
- <tal:block replace="request/user/title"
+ <tal:block replace="request/principal/title"
i18n:name="user">User</tal:block>
- (<tal:block replace="request/user/getLogin"
+ (<tal:block replace="request/principal/getLogin"
tal:on-error="string:anonymous"
i18n:name="login">login</tal:block>)
Modified: Zope3/branches/mgedmin-security/src/zope/app/zopetop/widget_macros.pt
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/zopetop/widget_macros.pt 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/app/zopetop/widget_macros.pt 2004-05-12 20:00:38 UTC (rev 24604)
@@ -10,7 +10,7 @@
<div class="user" metal:define-macro="logged_user" i18n:translate="">
Logged in as
- <span tal:replace="request/user/title" i18n:name="user_title">
+ <span tal:replace="request/principal/title" i18n:name="user_title">
dtremea</span>
</div>
Modified: Zope3/branches/mgedmin-security/src/zope/publisher/base.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/publisher/base.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/publisher/base.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -179,7 +179,8 @@
'_body', # The request body as a string
'_publication', # publication object
'_presentation_skin', # View skin
- '_user' # request user, set by publication
+ '_principal', # request principal, set by publication
+ 'interaction', # interaction, set by interaction
)
environment = RequestDataProperty(RequestEnvironment)
@@ -197,15 +198,16 @@
else:
self._response = response
self._response._request = self
-
+
self._body_instream = body_instream
self._held = ()
- self._user = None
+ self._principal = None
+ self.interaction = None
- def setUser(self, user):
- self._user = user
+ def setPrincipal(self, principal):
+ self._principal = principal
- user = property(lambda self: self._user)
+ principal = property(lambda self: self._principal)
def _getPublication(self):
'See IPublisherRequest'
Modified: Zope3/branches/mgedmin-security/src/zope/publisher/browser.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/publisher/browser.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/publisher/browser.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -625,10 +625,10 @@
self.setPresentationSkin(skin)
- def setUser(self, user):
+ def setPrincipal(self, principal):
# HTTPRequest needs to notify the HTTPTask of the username.
# We don't want to have to stub HTTPTask in the tests.
- BaseRequest.setUser(self, user)
+ BaseRequest.setPrincipal(self, principal)
class BrowserResponse(HTTPResponse):
"""Browser response
Modified: Zope3/branches/mgedmin-security/src/zope/publisher/http.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/publisher/http.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/publisher/http.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -453,12 +453,12 @@
self._response.setHeader("WWW-Authenticate", challenge, True)
self._response.setStatus(401)
- def setUser(self, user):
+ def setPrincipal(self, principal):
'See IPublicationRequest'
- super(HTTPRequest, self).setUser(user)
+ super(HTTPRequest, self).setPrincipal(principal)
if self.response.http_transaction is not None:
- logging_info = ILoggingInfo(user)
+ logging_info = ILoggingInfo(principal)
message = logging_info.getLogMessage()
self.response.http_transaction.setAuthUserName(message)
Modified: Zope3/branches/mgedmin-security/src/zope/publisher/interfaces/__init__.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/publisher/interfaces/__init__.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/publisher/interfaces/__init__.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -24,6 +24,7 @@
from zope.interface import implements
from zope.interface.common.mapping import IEnumerableMapping
from zope.interface.common.interfaces import IException
+from zope.security.interfaces import IParticipation
class IPublishingException(IException):
pass
@@ -279,16 +280,10 @@
"""
-class IPublicationRequest(IPresentationRequest):
+class IPublicationRequest(IPresentationRequest, IParticipation):
"""Interface provided by requests to IPublication objects
"""
- user = Attribute("""User object associated with the request
-
- It is up to the publication object to set this
- attribute by calling the setUser method.
- """)
-
response = Attribute("""The request's response object
Return an IPublisherResponse for the request.
@@ -325,8 +320,8 @@
It's up to the publication object to decide this.
"""
- def setUser(user):
- """Set the user attribute.
+ def setPrincipal(principal):
+ """Set the principal attribute.
It should be IPrincipal wrapped in it's AuthenticationService's context.
"""
@@ -391,9 +386,9 @@
"""Features that support application logic
"""
- user = Attribute("""User object associated with the request
- This is a read-only attribute.
- """)
+ principal = Attribute("""Principal object associated with the request
+ This is a read-only attribute.
+ """)
body = Attribute("""The body of the request as a string""")
Modified: Zope3/branches/mgedmin-security/src/zope/publisher/tests/test_http.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/publisher/tests/test_http.py 2004-05-12 19:28:27 UTC (rev 24603)
+++ Zope3/branches/mgedmin-security/src/zope/publisher/tests/test_http.py 2004-05-12 20:00:38 UTC (rev 24604)
@@ -255,7 +255,7 @@
lpw = req._authUserPW()
self.assertEquals(lpw, (login, password))
- def testSetUser(self):
+ def testSetPrincipal(self):
class HTTPTaskStub:
auth_user_name = None
def setAuthUserName(self, name):
@@ -263,11 +263,11 @@
task = HTTPTaskStub()
req = self._createRequest(outstream=task)
- req.setUser(UserStub("jim"))
+ req.setPrincipal(UserStub("jim"))
self.assert_(not req.response._outstream.auth_user_name)
req = self._createRequest(outstream=task)
req.response.setHTTPTransaction(task)
- req.setUser(UserStub("jim"))
+ req.setPrincipal(UserStub("jim"))
self.assertEquals(req.response.http_transaction.auth_user_name, "jim")
def testIPresentationRequest(self):
More information about the Zope3-Checkins
mailing list