From c7f347fe8185ca380efc32a3ec92a841576af8a8 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 15 Mar 2021 00:26:30 +0100 Subject: [PATCH] [autopatch] Autopatch to migrate to new permission system --- scripts/install | 14 ++++++-------- scripts/upgrade | 10 ++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index e3d7f38..ca96b7f 100644 --- a/scripts/install +++ b/scripts/install @@ -109,7 +109,7 @@ ynh_script_progression --message="Installing Leed with cURL..." --weight=5 chown -R $app: $final_path # Set the app as temporarily public for curl call -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + # Regen SSOwat configuration yunohost app ssowatconf @@ -162,14 +162,12 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failreg #================================================= ynh_script_progression --message="Configuring SSOwat..." --weight=2 -# Make app private if necessary -ynh_app_setting_set --app=$app --key=is_public --value="$is_public" -if [ $is_public -eq 0 ]; + + +# Make app public if necessary +if [ "$is_public" -eq 1 ] then - # Remove the public access - ynh_app_setting_delete --app=$app --key=unprotected_uris - # Set the action.php script public for the cron task - ynh_app_setting_set --app=$app --key=skipped_uris --value="/action.php" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 80e3ab7..d6edaaf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -132,6 +132,16 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# Migrate legacy permissions to new system +#================================================= +if ynh_legacy_permissions_exists +then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # ACTIVATE MAINTENANCE MODE #=================================================