From b086c0ca1e6ed9d9edb3c8ec44d1ff72f703989c Mon Sep 17 00:00:00 2001 From: Simon Mellerin Date: Sun, 7 Jan 2024 16:32:55 +0100 Subject: [PATCH] remove useless hooks --- hooks/post_app_addaccess | 41 ------------------------------------- hooks/post_app_removeaccess | 32 ----------------------------- scripts/install | 8 -------- scripts/upgrade | 8 -------- 4 files changed, 89 deletions(-) delete mode 100644 hooks/post_app_addaccess delete mode 100644 hooks/post_app_removeaccess diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess deleted file mode 100644 index cc14389..0000000 --- a/hooks/post_app_addaccess +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -app=$1 - -# Run only if we are altering aeneria's permissions -[[ "$app" != "__APP__" ]] && exit 0 - -# Source YunoHost helpers -source /usr/share/yunohost/helpers -source /etc/yunohost/apps/$app/scripts/_common.sh - -# Retrieve arguments -usernames=$2 -permission=$3 -groups=$4 -install_dir=$(ynh_app_setting_get "$app" install_dir) -phpversion=$(ynh_app_setting_get "$app" phpversion) - -IFS=',' read -r -a user_list <<< "$usernames" -IFS=',' read -r -a group_list <<< "$groups" - -for group in "${group_list[@]}" -do - group_array=$(yunohost user group list --output-as json --quiet | jq -r --arg group "$group" ".groups.$group.members | @csv" | tr -d \") - IFS=',' read -r -a group_array <<< "$group_array" - user_list+=("${group_array[@]}") -done - -pushd $install_dir - for user in "${user_list[@]}" - do - mail=$(ynh_user_get_info --username="$user" --key=mail) - user_exists=$(ynh_exec_as $app php$phpversion bin/console aeneria:user:exist "$mail") - if [ $user_exists -eq 0 ] - then - user_pass=$(ynh_string_random) - ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass" -n - else - ynh_exec_as $app php$phpversion bin/console aeneria:user:activate "$mail" - fi - done -popd diff --git a/hooks/post_app_removeaccess b/hooks/post_app_removeaccess deleted file mode 100644 index af784b5..0000000 --- a/hooks/post_app_removeaccess +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -app=$1 - -# Run only if we are altering aeneria's permissions -[[ "$app" != "__APP__" ]] && exit 0 - -# Source YunoHost helpers -source /usr/share/yunohost/helpers -source /etc/yunohost/apps/$app/scripts/_common.sh - -# Retrieve arguments -usernames=$2 -permission=$3 -groups=$4 -install_dir=$(ynh_app_setting_get "$app" install_dir) -phpversion=$(ynh_app_setting_get "$app" phpversion) - -IFS=',' read -r -a user_list <<< "$usernames" -IFS=',' read -r -a group_list <<< "$groups" - -for group in "${group_list[@]}" -do - group_array=$(yunohost user group list --output-as json --quiet | jq -r --arg group "$group" ".groups.$group.members | @csv" | tr -d \") - IFS=',' read -r -a group_array <<< "$group_array" - user_list+=("${group_array[@]}") -done - -for user in "${user_list[@]}" -do - mail=$(ynh_user_get_info --username="$user" --key=mail) - cd "$install_dir" && ynh_exec_as $app php$phpversion bin/console aeneria:user:deactivate "$mail" -n -done diff --git a/scripts/install b/scripts/install index 2f5653e..53fd869 100644 --- a/scripts/install +++ b/scripts/install @@ -76,14 +76,6 @@ ynh_add_config --template="aeneria.cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" -#================================================= -# ADAPT HOOK FOR AENERIA INSTANCE -#================================================= -ynh_script_progression --message="Adapting hooks..." --weight=1 - -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b2a524e..85f73f9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,14 +103,6 @@ pushd $install_dir ynh_exec_as $app php$phpversion bin/console aeneria:generate-key -n popd -#================================================= -# ADAPT HOOK FOR AENERIA INSTANCE -#================================================= -ynh_script_progression --message="Adapting hooks..." --weight=1 - -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess" - #================================================= # END OF SCRIPT #=================================================