archimed: improved toolbar support
This commit is contained in:
parent
29540f3cf8
commit
7520c3e7fd
|
@ -150,3 +150,18 @@ def registration_association(env, values, request, response):
|
|||
else:
|
||||
clean_registration_session(env, values, request, response)
|
||||
return response
|
||||
|
||||
def is_user_locally_logged_in(env, request, response):
|
||||
session = env['beaker.session']
|
||||
if session.has_key('locally_logged_in') and session['locally_logged_in']:
|
||||
return True
|
||||
return False
|
||||
|
||||
def is_logged_in(env, values, request, response):
|
||||
session = env['beaker.session']
|
||||
if response.msg and response and 'account_logoff' in response.msg:
|
||||
session['locally_logged_in'] = True
|
||||
else:
|
||||
session['locally_logged_in'] = False
|
||||
session.save()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
from mandaye.auth.saml2 import SAML2Auth
|
||||
from mandaye.auth.saml2 import END_POINTS_PATH
|
||||
from mandaye.filters.default import MandayeFilter
|
||||
|
||||
from cam.filters import archimed
|
||||
|
||||
|
@ -14,13 +14,17 @@ form_values = {
|
|||
'password_field': 'password',
|
||||
}
|
||||
|
||||
replay_condition = lambda env, response: '"success":true' in response.msg
|
||||
is_user_locally_logged_in = archimed.is_user_locally_logged_in
|
||||
|
||||
urls = {
|
||||
'login_url': '/mandaye/login',
|
||||
'logout_url': '/mandaye/logout',
|
||||
'connection_url': '/mandaye/sso',
|
||||
'associate_url': '/mandaye/associate',
|
||||
'disassociate_url': '/mandaye/disassociate',
|
||||
'disassociate_next_url': '/mandaye/logout',
|
||||
'logout_url': '/mandaye/logout',
|
||||
'toolbar_logout_url': '/mandaye/logout',
|
||||
}
|
||||
|
||||
mapping = [
|
||||
|
@ -38,6 +42,22 @@ mapping = [
|
|||
'content-types': ['text/html', 'application/javascript', 'application/x-javascript', 'application/json'],
|
||||
}]
|
||||
},
|
||||
{
|
||||
'path': r'%s' % form_values['post_url'],
|
||||
'method': 'POST',
|
||||
'on_request': [
|
||||
{'filter': MandayeFilter.store_request_content_buffer}
|
||||
],
|
||||
'on_response': [{'auth': 'store_credentials_in_session'}]
|
||||
},
|
||||
{
|
||||
'path': r'/EXPLOITATION/DEFAULT',
|
||||
'method': 'GET',
|
||||
'on_response': [{
|
||||
'content-types': ['text/html'],
|
||||
'filter': archimed.is_logged_in,
|
||||
}],
|
||||
},
|
||||
{
|
||||
'path': r'/mandaye/login$',
|
||||
'method': 'GET',
|
||||
|
@ -45,7 +65,6 @@ mapping = [
|
|||
'auth': 'login',
|
||||
'values': {
|
||||
'associate_url': '/mandaye/associate',
|
||||
'condition': "'\"success\":true' in response.msg"
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -118,7 +137,6 @@ mapping = [
|
|||
'method': 'POST',
|
||||
'response': {
|
||||
'auth': 'associate_submit',
|
||||
'values': {'condition': "'\"success\":true' in response.msg"}
|
||||
},
|
||||
'on_reponse': [
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ urls = {
|
|||
'associate_url': '/montpellier/extranet/login/mandaye_associate',
|
||||
'disassociate_url': '/mandaye/disassociate',
|
||||
'disassociate_next_url': '/mandaye/logout?next_url=/montpellier/extranet/login/usa_index_famille.php',
|
||||
'toolbar_logout_url': '/mandaye/logout?next_url=/montpellier/extranet/login/usa_index_famille.php',
|
||||
}
|
||||
|
||||
replay_condition = lambda env, response: "OK" in response.msg
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<ul class="mandaye-toolbar-link">
|
||||
% if is_login:
|
||||
<li>
|
||||
<a href="/mandaye/logout?next_url=/montpellier/extranet/login/usa_index_famille.php" title="Cliquer ici pour vous déconnecter de ${site_name} et du portail citoyen">Me déconnecter</a>
|
||||
<a href="${urls['toolbar_logout_url']}" title="Cliquer ici pour vous déconnecter de ${site_name} et du portail citoyen">Me déconnecter</a>
|
||||
</li>
|
||||
% if account:
|
||||
<li>
|
||||
|
|
Reference in New Issue