From 623355510554b14d6f361f60c791b862d01de75e Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 13 Mar 2022 23:05:21 +0100 Subject: [PATCH] revert logic :/ --- hooks/post_app_addaccess | 6 +++--- hooks/post_app_removeaccess | 4 ++-- scripts/install | 2 +- scripts/upgrade | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess index 9ae85f4..edef7b3 100644 --- a/hooks/post_app_addaccess +++ b/hooks/post_app_addaccess @@ -6,10 +6,10 @@ app=$1 users=$2 # Tous les utilisateurs autorisés sur l'app. Séparés par des virgules. if [ echo "$users" | grep visitors ]; then - if [ tail /etc/yunohost/apps/$app/conf/nginx.conf | grep "# proxy_set_header X-Remote-User" ]; then + if [ tail /etc/yunohost/apps/$app/conf/nginx.conf | grep " proxy_set_header X-Remote-User" ]; then #app is made public - ynh_replace_string "# proxy_set_header X-Remote-User" " proxy_set_header X-Remote-User" /etc/yunohost/apps/$app/conf/nginx.conf + ynh_replace_string " proxy_set_header X-Remote-User" "# proxy_set_header X-Remote-User" /etc/yunohost/apps/$app/conf/nginx.conf ynh_add_nginx_config ynh_systemd_action --service_name=nginx --action=reload fi -fi \ No newline at end of file +fi diff --git a/hooks/post_app_removeaccess b/hooks/post_app_removeaccess index 952b80f..5bd52ee 100644 --- a/hooks/post_app_removeaccess +++ b/hooks/post_app_removeaccess @@ -6,9 +6,9 @@ app=$1 users=$2 # Tous les utilisateurs autorisés sur l'app. Séparés par des virgules. if [ ! echo "$users" | grep visitors ]; then - if [ tail /etc/yunohost/apps/$app/conf/nginx.conf | grep " proxy_set_header X-Remote-User" ]; then + if [ tail /etc/yunohost/apps/$app/conf/nginx.conf | grep "# proxy_set_header X-Remote-User" ]; then #app is made public - ynh_replace_string " proxy_set_header X-Remote-User" "# proxy_set_header X-Remote-User" /etc/yunohost/apps/$app/conf/nginx.conf + ynh_replace_string "# proxy_set_header X-Remote-User" " proxy_set_header X-Remote-User" /etc/yunohost/apps/$app/conf/nginx.conf ynh_add_nginx_config ynh_systemd_action --service_name=nginx --action=reload fi diff --git a/scripts/install b/scripts/install index ed3c123..07889e1 100755 --- a/scripts/install +++ b/scripts/install @@ -120,7 +120,7 @@ if [ $path_url = "/" ] ; then ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf fi -if [ $is_public -eq 1 ]; then +if [ $is_public -eq 0 ]; then ynh_replace_string "# proxy_set_header X-Remote-User" " proxy_set_header X-Remote-User" ../conf/nginx.conf fi diff --git a/scripts/upgrade b/scripts/upgrade index 200dba4..f583b90 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -163,7 +163,7 @@ if [ $path_url = "/" ] ; then ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf fi -if [ ynh_permission_has_user --permission="main" --user=visitors ]; then +if [ ! ynh_permission_has_user --permission="main" --user=visitors ]; then ynh_replace_string "# proxy_set_header X-Remote-User" " proxy_set_header X-Remote-User" ../conf/nginx.conf fi # Create a dedicated nginx config