From 580d09bd00c53a7ff3b229d71b9fb7f130d23e7e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 14 Dec 2020 22:26:46 +0100 Subject: [PATCH] Set permissions --- scripts/install | 18 ++++-------------- scripts/restore | 2 +- scripts/upgrade | 10 ++++------ 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/scripts/install b/scripts/install index 147b403..2aa3731 100755 --- a/scripts/install +++ b/scripts/install @@ -101,10 +101,7 @@ ynh_script_progression --message="Setting up application with cURL..." chown -R $app: $final_path # Set the app as temporarily public for cURL call -ynh_script_progression --message="Configuring ssowat ..." -ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -# Reload SSOwat config -yunohost app ssowatconf +ynh_permission_update --permission "main" --add "visitors" # Reload NGINX ynh_systemd_action --service_name=nginx --action=reload @@ -113,12 +110,6 @@ ynh_systemd_action --service_name=nginx --action=reload ynh_script_progression --message="Finalizing installation..." ynh_local_curl "/install.php" "default_lang=$language" "install=Installer" "name=$admin" "login=$admin" "pwd=$password" "pwd2=$password" "data=1" "email=$admin@$domain" "timezone=Europe/Paris" -# Remove the public access -if [ $is_public -eq 0 ] -then - ynh_app_setting_delete --app=$app --key=skipped_uris -fi - #================================================= # REMOVING NO MORE NEEDED FILES #================================================= @@ -142,11 +133,10 @@ chown -R "$app":"$app" $final_path # modif perso #================================================= ynh_script_progression --message="Configuring SSOwat..." -# Make app public if necessary -if [ $is_public -eq 1 ] +# Make app public if necessary or protect it +if [ $is_public -eq 0 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + ynh_permission_update --permission "main" --remove "visitors" fi #================================================= diff --git a/scripts/restore b/scripts/restore index 601d6c8..2c3702e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -72,7 +72,7 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Restoring user rights..." # Restore permissions on app files -chown -R "$app":"$app" $final_path +chown -R $app:$app $final_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index e6c4e88..4b409f1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -128,18 +128,16 @@ ynh_secure_remove --file="${final_path}/update" ynh_script_progression --message="Securing files and directories..." # Set permissions on app files -chown -R "$app":"$app" $final_path # modif perso +chown -R $app:$app $final_path # modif perso #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1 -# Make app public if necessary -if [ $is_public -eq 1 ] +if [ $contains_visitors -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + ynh_permission_update --permission "main" --remove "visitors" fi #=================================================