From 1f3e7c006187cc813742b20fc60368a4be740299 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Fri, 10 Mar 2017 00:05:53 +0100 Subject: [PATCH] Lors de la modification d'une machine, on maj aussi le ldap --- machines/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/machines/models.py b/machines/models.py index 96f554f5..b5775ca6 100644 --- a/machines/models.py +++ b/machines/models.py @@ -150,6 +150,16 @@ class IpList(models.Model): def __str__(self): return self.ipv4 +@receiver(post_save, sender=Machine) +def machine_post_save(sender, **kwargs): + user = kwargs['instance'].user + user.ldap_sync(base=False, access_refresh=False, mac_refresh=True) + +@receiver(post_delete, sender=Machine) +def machine_post_delete(sender, **kwargs): + machine = kwargs['instance'] + user = machine.user + user.ldap_sync(base=False, access_refresh=False, mac_refresh=True) @receiver(post_save, sender=Interface) def interface_post_save(sender, **kwargs):