From 56a1fa361bd127fa47a3d9d208f1c70da17ef64b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sun, 10 Jul 2016 17:56:37 +0200 Subject: [PATCH] [enh] Use boolean type for ssoenabled argument --- manifest.json | 24 ++++++++++++------------ scripts/install | 15 +++++++-------- scripts/upgrade | 29 +++++++++++++---------------- 3 files changed, 32 insertions(+), 36 deletions(-) diff --git a/manifest.json b/manifest.json index 3751739..47fb235 100644 --- a/manifest.json +++ b/manifest.json @@ -20,24 +20,24 @@ "requirements": { "yunohost": ">= 2.4.0" }, - "multi_instance": "false", + "multi_instance": false, "arguments": { "install" : [ { "name": "domain", "type": "domain", "ask": { - "en": "Pod domain", + "en": "Domain of the pod", "fr": "Domaine du pod" }, "example": "domain.org" - }, - { + }, + { "name": "path", "type": "path", "ask": { - "en": "Path", - "fr": "Chemin du pod" + "en": "Path to the pod", + "fr": "Chemin vers le pod" }, "example": "/movim", "default": "/movim" @@ -71,18 +71,18 @@ }, { "name": "ssoenabled", + "type": "boolean", "ask": { - "en": "Enable SSO (autologin) ?", - "fr": "Activer le SSO (connexin auto) ?" + "en": "Enable SSO support (autologin)?", + "fr": "Activer le support du SSO (connexion auto) ?" }, - "choices": ["Yes", "No"], - "default": "Yes" + "default": true }, { "name": "port", "ask": { - "en": "Movim daemon port ? (internal only)", - "fr": "Port privé pour Movim ? (interne uniquement)" + "en": "Movim daemon port (internal only)", + "fr": "Port du daemon Movim (interne uniquement)" }, "default": "9537" } diff --git a/scripts/install b/scripts/install index 867d701..9352d50 100644 --- a/scripts/install +++ b/scripts/install @@ -128,15 +128,14 @@ sed -i "s@YHPORT@$port@g" ../conf/nginx.conf sed -i "s@//ws/@/ws/@g" ../conf/nginx.conf # Avoid duplicate / sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/movim.conf -# SSOwat Configuration -if [ $ssoenabled = "No" ]; -then - ynh_app_setting_set "$app" skipped_uris "/" - exec_cmd php mud.php config --xmppwhitelist=$domain +# SSOwat configuration +if [[ "$ssoenabled" = "0" ]]; then + ynh_app_setting_set "$app" skipped_uris "/" + exec_cmd php mud.php config --xmppwhitelist="$domain" else - ynh_app_setting_set "$app" unprotected_uris "/" - # Next line is to avoid SSO to auto-connect just after disconnect - sudo sed -i "s@redirect('login')@redirect('')@g" $DESTDIR/app/controllers/DisconnectController.php + ynh_app_setting_set "$app" unprotected_uris "/" + # Next line is to avoid SSO to auto-connect just after disconnect + sudo sed -i "s@redirect('login')@redirect('')@g" $DESTDIR/app/controllers/DisconnectController.php fi # Start Movim diff --git a/scripts/upgrade b/scripts/upgrade index eb5fee1..bcc4e7b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -52,25 +52,22 @@ ynh_app_setting_delete "$app" skipped_uris sudo yunohost app clearaccess movim # Replace old public_site variable (if exists) by ssoenabled -if [ ! -z "$public_site" ] && [ $public_site = "Yes" ]; -then - ynh_app_setting_delete "$app" public_site - ynh_app_setting_set "$app" ssoenabled "No" -elif [ ! -z "$public_site" ] && [ $public_site = "No" ]; -then - ynh_app_setting_delete "$app" public_site - ynh_app_setting_set "$app" ssoenabled "Yes" +if [ ! -z "$public_site" ]; then + [[ $public_site = "Yes" ]] \ + && ssoenabled=0 \ + || ssoenabled=1 + ynh_app_setting_delete "$app" public_site + ynh_app_setting_set "$app" ssoenabled "$ssoenabled" fi -# SSOwat Configuration -if [ $ssoenabled = "No" ]; -then - ynh_app_setting_set "$app" skipped_uris "/" - exec_cmd php mud.php config --xmppwhitelist=$domain +# SSOwat configuration +if [[ "$ssoenabled" =~ ^0|No$ ]]; then + ynh_app_setting_set "$app" skipped_uris "/" + exec_cmd php mud.php config --xmppwhitelist=$domain else - ynh_app_setting_set "$app" unprotected_uris "/" - # Next line is to avoid SSO to auto-connect just after disconnect - sudo sed -i "s@redirect('login')@redirect('')@g" $DESTDIR/app/controllers/DisconnectController.php + ynh_app_setting_set "$app" unprotected_uris "/" + # Next line is to avoid SSO to auto-connect just after disconnect + sudo sed -i "s@redirect('login')@redirect('')@g" $DESTDIR/app/controllers/DisconnectController.php fi # Update init scripts