From 473ae3afea31bf7597b0916568d0cd79a2060b6a Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 24 Oct 2017 04:32:24 +0200 Subject: [PATCH] Fix et optimise la collecte d'adresse mac pour ldap --- users/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/users/models.py b/users/models.py index 777352db..9574002e 100644 --- a/users/models.py +++ b/users/models.py @@ -576,10 +576,10 @@ class User(AbstractBaseUser): if access_refresh: user_ldap.dialupAccess = str(self.has_access()) if mac_refresh: - user_ldap.macs = [inter.mac_bare() for inter in - Interface.objects.filter( - machine__in=Machine.objects.filter(user=self) - )] + user_ldap.macs = [str(mac) for mac in Interface.objects.filter( + machine__user=self + ).values_list('mac_address', flat=True).distinct()] + user_ldap.save() def ldap_del(self):