From 7bed0cfb836e628044afea261ef2e5cabde1503d Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Tue, 28 Jan 2020 08:13:10 +0100 Subject: [PATCH 1/2] fix wrong user in hooks --- hooks/post_user_create | 3 ++- hooks/post_user_delete | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index 782d74b..1509e89 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,6 +1,7 @@ #!/bin/bash app="wallabag2" +user="wallabag2" # Retrieve arguments username=$1 @@ -14,5 +15,5 @@ user_pass=$(ynh_string_random) # Create the new user in Wallabag (cd "/var/www/$app" && \ - sudo sudo -u "www-data" php "bin/console" --no-interaction --env=prod \ + sudo -u "$user" php "bin/console" --no-interaction --env=prod \ fos:user:create "$username" "$user_email" "$user_pass") diff --git a/hooks/post_user_delete b/hooks/post_user_delete index 7420339..acda6ad 100644 --- a/hooks/post_user_delete +++ b/hooks/post_user_delete @@ -1,6 +1,7 @@ #!/bin/bash app="wallabag2" +user="wallabag2" # Retrieve arguments username=$1 @@ -8,5 +9,5 @@ purge=$2 # Deactivate the user from Wallabg (cd "/var/www/$app" && \ - sudo sudo -u "www-data" php "bin/console" --no-interaction --env=prod \ + sudo -u "$user" php "bin/console" --no-interaction --env=prod \ fos:user:deactivate "$username") From 6cfb7e2be7828e4233e353df175fb373b8e56007 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Sat, 21 Mar 2020 01:31:24 +0100 Subject: [PATCH 2/2] Fix hooks --- hooks/post_user_create | 4 ++-- hooks/post_user_delete | 4 ++-- scripts/install | 7 +++++++ scripts/upgrade | 7 +++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index 1509e89..40b0216 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,7 +1,7 @@ #!/bin/bash -app="wallabag2" -user="wallabag2" +app="__APP__" +user="__APP__" # Retrieve arguments username=$1 diff --git a/hooks/post_user_delete b/hooks/post_user_delete index acda6ad..6a39516 100644 --- a/hooks/post_user_delete +++ b/hooks/post_user_delete @@ -1,7 +1,7 @@ #!/bin/bash -app="wallabag2" -user="wallabag2" +app="__APP__" +user="__APP__" # Retrieve arguments username=$1 diff --git a/scripts/install b/scripts/install index 0a58263..1005880 100644 --- a/scripts/install +++ b/scripts/install @@ -167,6 +167,13 @@ chmod 600 $wb_conf chown -R $app: $final_path chmod 755 $final_path +#================================================= +# SETUP HOOKS +#================================================= + +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_create" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_delete" + #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 13fcb68..812e649 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -187,6 +187,13 @@ chmod 600 $wb_conf chown -R $app: $final_path chmod 755 $final_path +#================================================= +# SETUP HOOKS +#================================================= + +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_create" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_delete" + #================================================= # SETUP SSOWAT #=================================================