1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/duniter_ynh.git synced 2024-09-03 18:26:35 +02:00

[enh] Add a Cesium public access option

This commit is contained in:
Cédric Moreau 2017-02-15 10:45:04 +01:00 committed by cgeek
parent 821d2e2c8c
commit 51f91a24da
3 changed files with 20 additions and 2 deletions

View file

@ -96,7 +96,16 @@
"fr": "Administrateur. Ce doit être un utilisateur YunoHost" "fr": "Administrateur. Ce doit être un utilisateur YunoHost"
}, },
"example": "jon doe" "example": "jon doe"
} },
{
"name": "is_cesium_public",
"ask": {
"en": "Make Cesium available publicly?",
"fr": "Permettre à Cesium d'être consulté publiquement ?"
},
"choices": ["Yes", "No"],
"default": "Yes"
}
] ]
} }
} }

View file

@ -25,7 +25,14 @@ CONFIG_SSOWAT_FOR_RESTRICTED_ACCESS () {
sudo yunohost app addaccess $app -u $admin sudo yunohost app addaccess $app -u $admin
# Allow only allowed users to access admin panel # Allow only allowed users to access admin panel
ynh_app_setting_set "$app" protected_uris "/webui","/webmin","/cesium" if [ "$is_cesium_public" = "Yes" ];
then
# Cesium is public, do not protect it
ynh_app_setting_set "$app" protected_uris "/webui","/webmin"
else
# Cesium is not public, protect it
ynh_app_setting_set "$app" protected_uris "/webui","/webmin","/cesium"
fi
# Duniter is public app, with only some parts restricted in nginx.conf # Duniter is public app, with only some parts restricted in nginx.conf
sudo yunohost app setting $app unprotected_uris -v "/" sudo yunohost app setting $app unprotected_uris -v "/"

View file

@ -13,6 +13,7 @@ sync_port=$YNH_APP_ARG_SYNC_PORT
salt=$YNH_APP_ARG_SALT salt=$YNH_APP_ARG_SALT
password=$YNH_APP_ARG_PASSWORD password=$YNH_APP_ARG_PASSWORD
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
is_cesium_public=YNH_APP_ARG_IS_CESIUM_PUBLIC
# Source app helpers and functions # Source app helpers and functions
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -56,6 +57,7 @@ fi
ynh_app_setting_set $app port $port ynh_app_setting_set $app port $port
ynh_app_setting_set $app arch $arch ynh_app_setting_set $app arch $arch
ynh_app_setting_set "$app" admin "$admin" ynh_app_setting_set "$app" admin "$admin"
ynh_app_setting_set "$app" is_cesium_public "$is_cesium_public"
# Open port on firewall # Open port on firewall
sudo yunohost firewall allow TCP $port > /dev/null 2>&1 sudo yunohost firewall allow TCP $port > /dev/null 2>&1