ZPT Equivalent for SecurityGetUser
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="_.SecurityGetUser().getUserName() == '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="/manage_zmi_logout">log out of the Zope management interface</a>. </dtml-if> And my conversion looks like: <span tal:condition="python: here.REQUEST['AUTHENTICATED_USER'] == 'Anonymous User'"> <h3>Sie sind nun Ausgeloggt</h3> <a href="index_html" tal:attributes="href request/came_from" tal:condition="exists:request/came_from"> Zurück</a> <a href="index_html" tal:condition="not:exists:request/came_from">Zurück</a> </span> <span tal:condition="python: here.REQUEST['AUTHENTICATED_USER'] != 'Anonymous User'"> Sie sind noch mittels HTTP-Authentication eingelogged. Sie sich müssen eventuell <a href="/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 -- Your boss climbed the corporate ladder, wrong by wrong.
Andreas Pakulat wrote:
And my conversion looks like:
<span tal:condition="python: here.REQUEST['AUTHENTICATED_USER'] == 'Anonymous User'">
<span tal:condition="python:user.has_role(['Authenticated'])"> Cheers, Evan @ 4-am
On 20.Mai 2003 - 18:28:21, Evan Simpson wrote:
Andreas Pakulat wrote:
And my conversion looks like:
<span tal:condition="python: here.REQUEST['AUTHENTICATED_USER'] == 'Anonymous User'">
<span tal:condition="python:user.has_role(['Authenticated'])">
Thanks so much. That works even better than my own workaround: tal:define="name user/getUserName" tal:condition="python: name == 'Anonymous User'" Where I still wasn't logged out, but clicking the manage_zmi_logout Link worked. Now with you tip it works perfectly. Andreas -- Give your very best today. Heaven knows it's little enough.
On 21.Mai 2003 - 11:53:38, Andreas Pakulat wrote:
On 20.Mai 2003 - 18:28:21, Evan Simpson wrote:
Andreas Pakulat wrote:
And my conversion looks like:
<span tal:condition="python: here.REQUEST['AUTHENTICATED_USER'] == 'Anonymous User'">
<span tal:condition="python:user.has_role(['Authenticated'])">
Thanks so much. That works even better than my own workaround: tal:define="name user/getUserName" tal:condition="python: name == 'Anonymous User'"
Where I still wasn't logged out, but clicking the manage_zmi_logout Link worked.
Now with you tip it works perfectly.
Looks like that mail was send to early :( I had a small error in my logout_form, a "not" in the wrong place. I still have a problem when logging out, as it is not performed automagically :( When I click logout and this loads the logout_form ZPT I get the message "You're still logged in using ZMI" and a link where I can log off with manage_zmi_logout. Which works perfectly, but I wnat to have the user already logged off when he clicks on the Logout-Link and not to have him click on another link. It also doesn`t play a role if I exclude the macro-Things from the logout_form template. As said, the DTML-Method's work. Has anybody a hint why DTML works and ZPT not?! I think it has to do with this SecurityGetUser(), but am not sure. -- It's all in the mind, ya know.
participants (2)
-
Andreas Pakulat -
Evan Simpson