From 4231b3084e2f7475222dcbd75992b070b942486c Mon Sep 17 00:00:00 2001 From: Eragon Date: Tue, 20 Jun 2023 20:08:33 +0200 Subject: [PATCH] member: Delete members from LDAP on account deletion --- app/routes/account/account.py | 3 +++ app/routes/admin/account.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/app/routes/account/account.py b/app/routes/account/account.py index 31f8e90..e2baed5 100644 --- a/app/routes/account/account.py +++ b/app/routes/account/account.py @@ -117,6 +117,9 @@ def delete_account(): current_user.delete_posts() db.session.commit() + if (V5Config.USE_LDAP): + ldap.delete_member(current_user) + current_user.delete() logout_user() db.session.commit() diff --git a/app/routes/admin/account.py b/app/routes/admin/account.py index 3bd2ab7..883fdb2 100644 --- a/app/routes/admin/account.py +++ b/app/routes/admin/account.py @@ -9,6 +9,7 @@ from app.forms.account import AdminUpdateAccountForm, AdminDeleteAccountForm, \ AdminAccountEditTrophyForm, AdminAccountEditGroupForm from app.utils.render import render from app.utils.notify import notify +from app.utils import ldap as ldap from app import app, db from config import V5Config @@ -151,6 +152,9 @@ def adm_delete_account(user_id): user.delete_posts() db.session.commit() + if (V5Config.USE_LDAP): + ldap.delete_member(user) + user.delete() db.session.commit() flash('Compte supprimé', 'ok')