[Zope] ZPT Equivalent for SecurityGetUser

Andreas Pakulat ap125@informatik.uni-rostock.de
Wed, 21 May 2003 00:04:38 +0200


--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

I'm using CookieCrumbler for http-cookie-auth and using ZPT. Therefore I
tried to convert the standard DTML-Methods that a CookieCrumbler creates
into ZPT and the login_form and logged_in Methods were relatively easy.
But I cannot get the logged_out to work. I do net get logged out, even
not with calling manage_zmi_logout() (event thoug I only logged in using
HTTP-Cookie-Auth)

Heres the code for logged_out as DTML-Method, which works:

<dtml-if expr=3D"_.SecurityGetUser().getUserName() =3D=3D 'Anonymous User'">
 <h3>Logged out</h3>
 <p>Come again soon!</p>
<dtml-else>
 You are logged in using HTTP authentication.  You may need to
 <a href=3D"/manage_zmi_logout">log out of the Zope management
 interface</a>.
</dtml-if>

And my conversion looks like:

	<span tal:condition=3D"python: here.REQUEST['AUTHENTICATED_USER'] =3D=3D '=
Anonymous User'">
		<h3>Sie sind nun Ausgeloggt</h3>
		<a href=3D"index_html" tal:attributes=3D"href request/came_from" tal:cond=
ition=3D"exists:request/came_from">
			Zur&uuml;ck</a>
		<a href=3D"index_html" tal:condition=3D"not:exists:request/came_from">Zur=
&uuml;ck</a>
	</span>
	<span tal:condition=3D"python: here.REQUEST['AUTHENTICATED_USER'] !=3D 'An=
onymous User'">
		Sie sind noch mittels HTTP-Authentication eingelogged. Sie sich m=FCssen
		eventuell <a href=3D"/manage_zmi_logout">aus dem Zope Managment Interface
		ausloggen</a>.
	</span>

Sorry for the long lines. I think it has to do with the
AUTHENTICATED_USER Variable and the original DTML calls SecurityGetUser,
but I cannot access this function from python or directly in ZPT.

Andreas

--=20
Your boss climbed the corporate ladder, wrong by wrong.

--C7zPtVaVf+AK4Oqc
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+yqZ2uekl0h+nrMIRAtMuAJ4phG9/2MrpWQtqgRpIkRyWeMY7KACdG0hQ
W++Cs4LlPj81pAHjnUbLpI8=
=BkpF
-----END PGP SIGNATURE-----

--C7zPtVaVf+AK4Oqc--