From f553c1322a1fd25e4f8e7e642c9a65e9c4fee1f6 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 15 Mar 2021 00:26:07 +0100 Subject: [PATCH] [autopatch] Autopatch to migrate to new permission system --- scripts/install | 11 +++++------ scripts/upgrade | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 4568211..8b5ab5f 100755 --- a/scripts/install +++ b/scripts/install @@ -36,7 +36,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app $app --key admin --value $admin ynh_app_setting_set --app $app --key language --value $language ynh_app_setting_set --app $app --key final_path --value $final_path -ynh_app_setting_set --app $app --key is_public --value $is_public ynh_app_setting_set --app $app --key service_autodiscovery --value $service_autodiscovery ynh_app_setting_set --app $app --key whups_install --value $whups_install ynh_app_setting_set --app $app --key sesha_install --value $sesha_install @@ -158,11 +157,11 @@ set_permission # configure the sso ynh_script_progression --message="Configuring permissions..." -if [ "$is_public" = "0" ]; -then # Retire l'accès public - ynh_app_setting_delete --app $app --key skipped_uris -else - ynh_app_setting_set --app $app --key unprotected_uris --value "/" + +# Make app public if necessary +if [ "$is_public" -eq 1 ] +then + ynh_permission_update --permission="main" --add="visitors" fi # SETUP LOGROTATE diff --git a/scripts/upgrade b/scripts/upgrade index dee9cef..9d79eeb 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,6 +10,16 @@ source /usr/share/yunohost/helpers # 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 + # Import common cmd source ./experimental_helper.sh source ./_common.sh @@ -38,6 +48,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 + #================================================= # STANDARD UPGRADE STEPS #=================================================