[Zope-dev] how to change to another authenticated user programmatically?

Craeg K Strong cstrong@arielpartners.com
Tue, 24 Sep 2002 13:41:00 -0400


Hello:

I am working on an application where users register themselves.  That is,
there will be a registrar username and password that is sent out to all
prospective users via email.

The only thing the registrar can do is add a user.

The most convenient thing would be for the user to log in as the registrar,
add himself as a user, and then the application woud immediately recognize him
as *the new user* from then on, without the user having to exit the browser,
restart it, and login as the new user.

The new user is added using the standard _addUser() function on the user folder,
so it is a valid Zope user.

Does anyone know how to change the current AUTHENTICATED_USER programmatically?

That is, the "user" object in my ZPTs would thereafter be the *new* user,
not the registrar?

Alternative number two is to force the user to reauthenticate-- somehow get the
browser to popup a login screen where the user can type in the new username and
password.   This might be easier, b/c it is simply a matter of sending
back the appropriate HTTP Header and status codes, right?

Thanks in advance!

--Craeg