From a582053ba68e5bcd655ad4a3431dfa1eda34a7e3 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 1ffc0c6..10d0707 100644 --- a/app/routes/account/account.py +++ b/app/routes/account/account.py @@ -119,6 +119,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 8a7ff6f..9179164 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 @@ -154,6 +155,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')