[Zope] become user (su inside Zope) - pretend to be another user
Brad Clements
bkc at murkworks.com
Thu Oct 23 19:52:23 EDT 2003
Thanks for this tip, interestingly that's open exactly what I had come up
with, thanks for the confirmation:
I looked at newSecurityManager and it doesn't seem to set
request.AUTHENTICATED_USERS, so I do that too.
dn = "cn=dr,ou=sfiusa,ou=Public,dc=zyx,dc=com"
def test(request, context):
"""test stuff"""
uf = context.acl_users
u = uf.getUserByDN(dn)
if u is None: raise RuntimeError()
newSecurityManager(None, u)
request.AUTHENTICATED_USER = u
On 23 Oct 2003 at 23:02, Stefan H. Holek wrote:
Date sent: Thu, 23 Oct 2003 23:02:51 +0200
From: "Stefan H. Holek" <stefan at epy.co.at>
To: bkc at murkworks.com
Copies to: zope at zope.org
Subject: Re: [Zope] become user (su inside Zope) - pretend to be another
user
> You can do the following (in an ExternalMethod):
>
> from AccessControl.SecurityManagement import newSecurityManager
>
> uf = self.acl_users
> user = uf.getUserById('blah').__of__(uf)
> newSecurityManager(None, user)
> # You are now logged in as user 'blah'
>
> Stefan
>
>
> --On Donnerstag, 23. Oktober 2003 15:14 -0400 Brad Clements
> <bkc at murkworks.com> wrote:
>
> > I need to save and then "replay" web requests at a later time on behalf
> > of an authenticated user, then email them the result.
>
>
>
> --
> The time has come to start talking about whether the emperor is as well
> dressed as we are supposed to think he is. /Pete McBreen/
--
Brad Clements, bkc at murkworks.com (315)268-1000
http://www.murkworks.com (315)268-9812 Fax
http://www.wecanstopspam.org/ AOL-IM: BKClements
More information about the Zope
mailing list