From 69e2ac84b0454a5159187d1f65f1d51a498622df Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 4 Feb 2021 12:44:49 +0100 Subject: [PATCH] Add permissions --- scripts/install | 10 +++++++--- scripts/remove | 11 +++++++++++ scripts/restore | 7 +++++++ scripts/upgrade | 14 +++++++++----- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index 3478e2a..2ee8492 100644 --- a/scripts/install +++ b/scripts/install @@ -88,8 +88,12 @@ ynh_script_progression --message="Configuring NGINX web server..." ynh_add_nginx_config #================================================= -# SPECIFIC SETUP +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." + +yunohost service add $app --description="LibreOffice-based online office suite" --log="/var/log/$app/$app.log" + #================================================= # GENERIC FINALIZATION #================================================= @@ -104,11 +108,11 @@ ynh_systemd_action --service_name="loolwsd" --action="restart" --log_path="syste #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Make app public # unprotected_uris allows SSO credentials to be passed anyway. -ynh_app_setting_set $app unprotected_uris "/" +ynh_permission_update --permission="main" --add="visitors" --show_tile="false" #================================================= # RELOAD NGINX diff --git a/scripts/remove b/scripts/remove index ecd3650..66c8507 100644 --- a/scripts/remove +++ b/scripts/remove @@ -21,6 +21,17 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # STANDARD REMOVE +#================================================= +# REMOVE SERVICE INTEGRATION IN YUNOHOST +#================================================= + +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null +then + ynh_script_progression --message="Removing $app service integration..." + yunohost service remove $app +fi + #================================================= # REMOVE DEPENDENCIES #================================================= diff --git a/scripts/restore b/scripts/restore index 5078f9f..55ed06f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -63,6 +63,13 @@ ynh_script_progression --message="Restoring the configuration..." ynh_restore_file --origin_path="/etc/loolwsd/loolwsd.xml" +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." + +yunohost service add $app --description="LibreOffice-based online office suite" --log="/var/log/$app/$app.log" + #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e755dff..e658ae3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -42,6 +42,12 @@ if [ -z "$path_url" ]; then ynh_app_setting_set --app=$app --key=path_url --value=$path_url fi +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 #================================================= @@ -94,13 +100,11 @@ ynh_add_config "../conf/loolwsd.xml" "/etc/loolwsd/loolwsd.xml" #================================================= # GENERIC FINALIZATION #================================================= -# SETUP SSOWAT +# INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Integrating service in YunoHost..." -# Make app public -# unprotected_uris allows SSO credentials to be passed anyway -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" +yunohost service add $app --description="LibreOffice-based online office suite" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE