mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-09 03:16:25 +00:00
Si l'instance ldap_user existe pas on l'ajoute sans bruit
This commit is contained in:
parent
fd0cce6f9e
commit
241d2462c3
1 changed files with 5 additions and 2 deletions
|
@ -545,12 +545,16 @@ class User(AbstractBaseUser):
|
||||||
mail, password, shell, home
|
mail, password, shell, home
|
||||||
access_refresh : synchronise le dialup_access notant si l'user a accès
|
access_refresh : synchronise le dialup_access notant si l'user a accès
|
||||||
aux services
|
aux services
|
||||||
mac_refresh : synchronise les machines de l'user"""
|
mac_refresh : synchronise les machines de l'user
|
||||||
|
Si l'instance n'existe pas, on crée le ldapuser correspondant"""
|
||||||
self.refresh_from_db()
|
self.refresh_from_db()
|
||||||
try:
|
try:
|
||||||
user_ldap = LdapUser.objects.get(uidNumber=self.uid_number)
|
user_ldap = LdapUser.objects.get(uidNumber=self.uid_number)
|
||||||
except LdapUser.DoesNotExist:
|
except LdapUser.DoesNotExist:
|
||||||
user_ldap = LdapUser(uidNumber=self.uid_number)
|
user_ldap = LdapUser(uidNumber=self.uid_number)
|
||||||
|
base = True
|
||||||
|
access_refresh = True
|
||||||
|
mac_refresh = True
|
||||||
if base:
|
if base:
|
||||||
user_ldap.name = self.pseudo
|
user_ldap.name = self.pseudo
|
||||||
user_ldap.sn = self.pseudo
|
user_ldap.sn = self.pseudo
|
||||||
|
@ -574,7 +578,6 @@ class User(AbstractBaseUser):
|
||||||
user_ldap.macs = [str(mac) for mac in Interface.objects.filter(
|
user_ldap.macs = [str(mac) for mac in Interface.objects.filter(
|
||||||
machine__user=self
|
machine__user=self
|
||||||
).values_list('mac_address', flat=True).distinct()]
|
).values_list('mac_address', flat=True).distinct()]
|
||||||
|
|
||||||
user_ldap.save()
|
user_ldap.save()
|
||||||
|
|
||||||
def ldap_del(self):
|
def ldap_del(self):
|
||||||
|
|
Loading…
Reference in a new issue