From f2e6f307408696d76fb7074c2956f905d89ebb0b Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Fri, 26 Feb 2021 19:39:55 +0100 Subject: [PATCH 1/2] [fix] migrate to new permission system --- manifest.json | 2 +- scripts/install | 7 ++++--- scripts/remove | 2 -- scripts/upgrade | 25 ++++++++++++------------- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/manifest.json b/manifest.json index 976cfd9..0d08f23 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "gofannon@riseup.net" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.2" }, "multi_instance": true, "services": [ diff --git a/scripts/install b/scripts/install index 3e3064e..7369b09 100644 --- a/scripts/install +++ b/scripts/install @@ -88,13 +88,14 @@ chown -R root: $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=3 +ynh_script_progression --message="Configuring permissions..." --weight=3 # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/remove b/scripts/remove index a0f80d2..8657f4c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,8 +16,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) - final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 93d41e4..1f75344 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -27,6 +26,18 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -84,18 +95,6 @@ fi # Set permissions on app files chown -R root: $final_path -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=3 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # RELOAD NGINX #================================================= From fcdee59d555e50e093422229c658807ad02bc361 Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Fri, 26 Feb 2021 19:40:19 +0100 Subject: [PATCH 2/2] [enh] add CI test for new permission system --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 1b2e1c9..e1c97a6 100644 --- a/check_process +++ b/check_process @@ -11,7 +11,7 @@ setup_private=1 setup_public=1 upgrade=1 - #upgrade=1 from_commit=CommitHash + upgrade=1 from_commit=9e0c1be11dfe6485ab66f898494eff5bd6bac817 backup_restore=1 multi_instance=1 change_url=1