1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/aeneria_ynh.git synced 2024-09-03 18:06:15 +02:00

remove useless hooks

This commit is contained in:
Simon Mellerin 2024-01-07 16:32:55 +01:00
parent 4b7367721a
commit b086c0ca1e
4 changed files with 0 additions and 89 deletions

View file

@ -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

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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
#=================================================