arcopole: finilize toolbar and fixing last bugs

This commit is contained in:
Jérôme Schneider 2014-09-05 19:21:48 +02:00
parent 04903975c2
commit 6e82eeef5e
6 changed files with 50 additions and 30 deletions

View File

@ -133,6 +133,7 @@ use_long_trace = config.getboolean('debug', 'use_long_trace')
auto_decompress = config.getboolean('mandaye', 'auto_decompress')
# Ask mandaye to add a toolbar with Mandaye's links
mandaye_toolbar = config.getboolean('mandaye', 'toolbar')
mandaye_offline_toolbar = config.getboolean('mandaye', 'offline_toolbar')
# Authentic 2 auto connection
a2_auto_connection = config.getboolean('mandaye', 'a2_auto_connection')

View File

@ -24,6 +24,7 @@ sentry_dsn:
[mandaye]
toolbar: true
offline_toolbar: true
a2_auto_connection: false
; only sql at the moment
storage_backend: sql

View File

@ -9,3 +9,10 @@ class ArcopoleFilter:
response.msg = associate
return response
@staticmethod
def is_action_logout(env, request, response):
request.msg = request.msg.read()
if "logout" in request.msg:
return True
return False

View File

@ -27,19 +27,20 @@ from mandaye_cud.filters.cud import ArcopoleFilter
from mandaye.filters.default import MandayeFilter
form_values = {
'login_url': '/studio/accueil?callback=mamaman',
'login_url': '/studio/accueil?callback=acallback',
'post_url': '/studio/login?callback=acallback',
'form_attrs': { 'id': 'login-form' },
'post_fields': ['username', 'password'],
'username_field': 'username',
'password_field': 'password',
}
}
urls = {
'associate_url': '/studio/mandayeassociate',
'connection_url': '/mandaye/sso',
'disassociate_url': '/mandaye/disassociate',
'login_url': '/mandaye/login'
}
'associate_url': '/studio/mandayeassociate',
'connection_url': '/mandaye/sso',
'disassociate_url': '/mandaye/disassociate',
'login_url': '/mandaye/login'
}
mapping = [
{
@ -62,11 +63,25 @@ mapping = [
'method': 'GET',
'response': {'auth': 'sso',}
},
{
'path': r'/studio/locallogout$',
'method': 'GET',
'response': {'auth': 'local_logout', 'values': {'next_url': '/studio/accueil'}}
},
{
'path': r'/mandaye/slo$',
'method': 'GET',
'response': {'auth': 'slo',}
},
},
{
'path': r'/mandaye/disassociate$',
'method': 'GET',
'response': {
'auth': 'disassociate',
'values': {'next_url': '/studio/locallogout',},
}
},
{
'path': r'/studio/mandayeassociate$',
'method': 'GET',
@ -76,21 +91,20 @@ mapping = [
'values': {
'action': urls['associate_url'],
'template': 'arcopole/associate.html',
'sp_name': 'Arcopole',
'login_name': form_values['username_field'],
'password_name': form_values['password_field'],
},
},]
},
{
'path': r'/studio/mandayeassociate$',
'method': 'POST',
'response': {
'auth': 'associate_submit',
'values': {'condition': "'success' in response.msg"}
'path': r'/studio/mandayeassociate$',
'method': 'POST',
'response': {
'auth': 'associate_submit',
'values': {
'condition': "'success' in response.msg",
}
},
},
},
{
'path': r'%s$' % END_POINTS_PATH['single_sign_on_post'],
'method': 'POST',

View File

@ -163,17 +163,6 @@ function majApplications() {
// User messages
var msgStart = "<span style=\"text-align: center; line-height:10em;\"><h5>";
var msgEnd ="</h5></span>";
if (n == 0)
{
if ($('#userinfo-username').html() == "")
{
$('#arcopole-app').html(msgStart + "Aucune application accessible, veuillez vous connecter" + msgEnd);
}
else
{
$('#arcopole-app').html(msgStart + "Aucune application disponible" + msgEnd);
}
}
// un appid a ete fourni ? et l'authentification n'est pas requise ?
// attention un mix de jsp (server) et javascript ( client )!!!
@ -234,6 +223,8 @@ function load() {
majUserInfo();
}
</script>
<script src="${static_url}/js/toolbar.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="${static_url}/css/toolbar.css">
</head>
<body onload="javascript:load();">
@ -276,7 +267,7 @@ function load() {
</div>
<div id="login-box" title="Associer arcOpole Studio">
<form id="login-form" action=".">
<form id="login-form" action="mandayeassociate?next_url=/studio/accueil" method="post">
<p>Veuillez saisir votre identifiant et votre mot de
passe afin de les associer avec votre compte partenaire.</p>
<div id="login-box-error" class="authent-error"></div>

View File

@ -8,12 +8,18 @@
</div>
<div class="mandaye-toolbar-right">
<ul class="mandaye-toolbar-link">
% if is_login:
<li>
<a href="/mandaye/logout">Me déconnecter</a>
</li>
% if account:
<li>
<a href="javascript:mandaye_disassociate_logout('${account.login}', ${account.id})" title="Cliquer ici pour supprimer l'association entre ce compte et votre compte citoyen.">Me désassocier</a>
<a href="javascript:mandaye_disassociate_logout('${urls['disassociate_url']}', '${account.login}', ${account.id})" title="Cliquer ici pour supprimer l'association entre ce compte et votre compte citoyen.">Me désassocier</a>
</li>
% endif
% else:
<li>
<a href="/mandaye/sso" title="Cliquer ici pour vous connecter sur ${site_name}">Me connecter</a>
</li>
% endif
</ul>