From 80cc9e1b025c5eca09e6272d3d8b880e7d000191 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 15 Mar 2021 00:26:39 +0100 Subject: [PATCH] [autopatch] Autopatch to migrate to new permission system --- scripts/install | 7 +++---- scripts/upgrade | 10 ++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 7549132..0e31ad1 100644 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=theme --value=$theme ynh_app_setting_set --app=$app --key=secret --value=$secret ynh_app_setting_set --app=$app --key=hashed_password --value=$hashed_password @@ -195,7 +194,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= ynh_script_progression --message="Configuring SSOwat..." -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + if [ $is_public -eq 0 ] then # If the app is private, only the shortened URLs are publics. @@ -204,8 +203,8 @@ then path_url="" fi # Modify the domain to be used in a regex - domain_regex=$(echo "$domain" | sed 's@-@.@g') - ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/login$","$domain_regex$path_url/logout$","$domain_regex$path_url/api$","$domain_regex$path_url/extensions$","$domain_regex$path_url/stats$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/a$","$domain_regex$path_url/$" + + fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bc04e31..9af9a3d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -112,6 +112,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 #=================================================