From a88855faed6c25b87c6b330d088633e17ecb428f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20Barrobe=CC=81s?= Date: Tue, 5 Mar 2024 11:11:07 +0100 Subject: [PATCH] Delete from LDAP as we delete a user instance --- humans/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/humans/models.py b/humans/models.py index 5e07f67..ebc1131 100644 --- a/humans/models.py +++ b/humans/models.py @@ -20,6 +20,10 @@ def save(self, *args, **kwargs): if password is not None: self.__ldap__set_password(password) + def delete(self, *args, **kwargs): + directory.delete_user(directory.connect(), self.username) + super().delete(*args, **kwargs) + def __ldap__save(self): max_user_id = User.objects.aggregate(Max("id"))["id__max"] or 1 connection = directory.connect()