1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mygpo_ynh.git synced 2024-09-03 19:55:52 +02:00
mygpo_ynh/hooks/post_user_delete
Jules Bertholet 8284155ea3
Update to 2021-10-20 (#13)
* Update to 1627ed9d3dddb2a6d0fb85b598d7736f19a06b47

* Update to 2021-06-16

* Update to 2021-09-13

* Update to version 2021-10-11

* use `makemigrations --merge` on migrate

* Update 20 version 2021-10-20

* Apply example_ynh

* Auto-update README

* Fix upgrade

* fix datadir

Co-authored-by: Jules Bertholet <jules.bertholet@quoi.xyz>
Co-authored-by: yalh76 <yalh@yahoo.com>
Co-authored-by: Yunohost-Bot <>
2022-02-02 15:42:33 -05:00

25 lines
594 B
Bash

#!/usr/bin/env bash
source /usr/share/yunohost/helpers
app="${0//.\/50-}"
username=$1
purge=$2
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
env_path=$final_path/envs/prod
pushd $final_path || ynh_die
ynh_exec_as $app $final_path/venv/bin/envdir $env_path $final_path/venv/bin/python $final_path/manage.py shell <<< "
from django.contrib.auth import get_user_model
User = get_user_model()
try:
user = User.objects.get(username='$user')
user.is_active = False
user.save()
if $purge:
user.delete()
except User.DoesNotExist:
pass
"
popd || ynh_die