[Grok-dev] Grok UI Manager Logout
Miguel Beltran R.
yourpadre at gmail.com
Mon Aug 8 10:13:05 EDT 2011
2011/8/7 paul <paul at aptrackers.com>
> I was wondering whether there's an easier way to do this.
>
> Currently, whenever I use the grok UI manager interface, my grok instance
> remains logged in as manager- so my app PAU instance detects a valid login
> and doesn't allow me to log out. I can log out my own users at application
> level, but since the 'manager' identity is not managed by my own PAU
> instance, I cannot seem to log out manager.
>
> Currently, I clear the zope session cookie, close the browser tab, and
> reload the URL to clear the login. I'm sure there's an easier way, but
> after much searching through the web online docs and the zope implementation
> code, I'm blowed if I know what it is.
>
> Can someone point me in the right direction?
>
>
>
I do this to logout using Basic Auth.
It detect if I'm logged, if it's true then raise an unauthorized status and
ask again for user and password. Just press OK and you are logout.
PageTemplate:
<div id="cuadro-usuario"
tal:define="usr user/getUserName">
<div tal:condition="python: usr <> 'Anonymous User'">
<span tal:condition="exists: request/salgo">
<span tal:define="x context/scripts/usuario_salir"></span>
</span>
<span tal:content="usr"></span>
<a tal:attributes="href python:request.BASE2 + '?salgo=true'"
target="_parent"> - Logout</a>
</div>
<div tal:condition="python: usr == 'Anonymous User'">
<span tal:condition="exists: request/entro">
<span tal:define="x context/scripts/usuario_entrar"></span>
</span>
<a tal:attributes="href python:request.BASE2 + '?entro=true'"
target="_parent">Login</a>
</div>
</div>
<usuario_entrar>:
request = container.REQUEST
response = request.RESPONSE
response.setStatus('Unauthorized')
response.setHeader('WWW-Authenticate', 'basic realm="OPTIMUSMX', 1)
<usuario_salir>:
request = container.REQUEST
response = request.RESPONSE
response.setHeader('WWW-Authenticate', 'basic realm="OPTIMUSMX', 1)
response.setStatus('Unauthorized')
--
________________________________________
Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20110808/d4dcac3a/attachment.html
More information about the Grok-dev
mailing list