Hello Roger,
Roger Demetrescu a écrit :
> Hi guys,
>
> My coworker is migrating a delphi application into a TG's app. One of
> the main requests is that everytime the user hits an important screen
> (aka controller/method), he(she) must enter his(her) username &
> password.
>
> Let me give an example to clarify this scenario:
>
> 1) I try to hit the "/" url.. since the entire system demands
> non_anonymous navigantion, I must provide my identification.. and the
> current identity becomes "Roger Demetrescu"
>
> 2) Then I hit a "/sales/list/' url.. and the system should ask again
> for the user & password... maybe I enter "RogerDemetrescu / 123", and
> continue to be the current identity... maybe I enter "Alberto_Valverde
> / 987" and then he will be the new user... until he hits another url
> which will ask again for authentication...
>
>
> What's the best way to accomplish this behavior ?
>
>
Why don't you try to logout any current user by executing something
before "evaluating" the new page ?
This could (perhaps) be done with a decorator called before all the
others like
@logout()
@expose(...)
...
and
def logout():
def decorator(func):
def wrapper(*args, **kw):
# logout any user currently connected
if identity.not_anonymous():
identity.current.logout()
output = func(*args, **kw) # do the page processing
return output
return wrapper
return decorator
I have not tested this (I'm not even sure sure the syntax is correct...)
I'm not sure it will work but it is worth trying... You would not have to
change anything in the identity module.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---