1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

[enh] Use boolean type for ssoenabled argument

This commit is contained in:
Jérôme Lebleu 2016-07-10 17:56:37 +02:00
parent 9ae09c9f4e
commit 56a1fa361b
3 changed files with 32 additions and 36 deletions

View file

@ -20,24 +20,24 @@
"requirements": { "requirements": {
"yunohost": ">= 2.4.0" "yunohost": ">= 2.4.0"
}, },
"multi_instance": "false", "multi_instance": false,
"arguments": { "arguments": {
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": { "ask": {
"en": "Pod domain", "en": "Domain of the pod",
"fr": "Domaine du pod" "fr": "Domaine du pod"
}, },
"example": "domain.org" "example": "domain.org"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": { "ask": {
"en": "Path", "en": "Path to the pod",
"fr": "Chemin du pod" "fr": "Chemin vers le pod"
}, },
"example": "/movim", "example": "/movim",
"default": "/movim" "default": "/movim"
@ -71,18 +71,18 @@
}, },
{ {
"name": "ssoenabled", "name": "ssoenabled",
"type": "boolean",
"ask": { "ask": {
"en": "Enable SSO (autologin) ?", "en": "Enable SSO support (autologin)?",
"fr": "Activer le SSO (connexin auto) ?" "fr": "Activer le support du SSO (connexion auto) ?"
}, },
"choices": ["Yes", "No"], "default": true
"default": "Yes"
}, },
{ {
"name": "port", "name": "port",
"ask": { "ask": {
"en": "Movim daemon port ? (internal only)", "en": "Movim daemon port (internal only)",
"fr": "Port privé pour Movim ? (interne uniquement)" "fr": "Port du daemon Movim (interne uniquement)"
}, },
"default": "9537" "default": "9537"
} }

View file

@ -128,15 +128,14 @@ sed -i "s@YHPORT@$port@g" ../conf/nginx.conf
sed -i "s@//ws/@/ws/@g" ../conf/nginx.conf # Avoid duplicate / sed -i "s@//ws/@/ws/@g" ../conf/nginx.conf # Avoid duplicate /
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/movim.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/movim.conf
# SSOwat Configuration # SSOwat configuration
if [ $ssoenabled = "No" ]; if [[ "$ssoenabled" = "0" ]]; then
then ynh_app_setting_set "$app" skipped_uris "/"
ynh_app_setting_set "$app" skipped_uris "/" exec_cmd php mud.php config --xmppwhitelist="$domain"
exec_cmd php mud.php config --xmppwhitelist=$domain
else else
ynh_app_setting_set "$app" unprotected_uris "/" ynh_app_setting_set "$app" unprotected_uris "/"
# Next line is to avoid SSO to auto-connect just after disconnect # 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 sudo sed -i "s@redirect('login')@redirect('')@g" $DESTDIR/app/controllers/DisconnectController.php
fi fi
# Start Movim # Start Movim

View file

@ -52,25 +52,22 @@ ynh_app_setting_delete "$app" skipped_uris
sudo yunohost app clearaccess movim sudo yunohost app clearaccess movim
# Replace old public_site variable (if exists) by ssoenabled # Replace old public_site variable (if exists) by ssoenabled
if [ ! -z "$public_site" ] && [ $public_site = "Yes" ]; if [ ! -z "$public_site" ]; then
then [[ $public_site = "Yes" ]] \
ynh_app_setting_delete "$app" public_site && ssoenabled=0 \
ynh_app_setting_set "$app" ssoenabled "No" || ssoenabled=1
elif [ ! -z "$public_site" ] && [ $public_site = "No" ]; ynh_app_setting_delete "$app" public_site
then ynh_app_setting_set "$app" ssoenabled "$ssoenabled"
ynh_app_setting_delete "$app" public_site
ynh_app_setting_set "$app" ssoenabled "Yes"
fi fi
# SSOwat Configuration # SSOwat configuration
if [ $ssoenabled = "No" ]; if [[ "$ssoenabled" =~ ^0|No$ ]]; then
then ynh_app_setting_set "$app" skipped_uris "/"
ynh_app_setting_set "$app" skipped_uris "/" exec_cmd php mud.php config --xmppwhitelist=$domain
exec_cmd php mud.php config --xmppwhitelist=$domain
else else
ynh_app_setting_set "$app" unprotected_uris "/" ynh_app_setting_set "$app" unprotected_uris "/"
# Next line is to avoid SSO to auto-connect just after disconnect # 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 sudo sed -i "s@redirect('login')@redirect('')@g" $DESTDIR/app/controllers/DisconnectController.php
fi fi
# Update init scripts # Update init scripts