From 71f8dacb2cdbd6db01bc0f868313854dbd7d972b Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Fri, 31 Aug 2018 13:35:33 +0200 Subject: [PATCH] No harcoded var --- users/models.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/users/models.py b/users/models.py index 212754e2..9c4f5f4e 100755 --- a/users/models.py +++ b/users/models.py @@ -571,11 +571,13 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, try: user_ldap = LdapUser.objects.get(uidNumber=self.uid_number) except LdapUser.DoesNotExist: - if self.state != 3: - user_ldap = LdapUser(uidNumber=self.uid_number) - base = True - access_refresh = True - mac_refresh = True + # Freshly created users are NOT synced in ldap base + if self.state == self.STATE_NOT_YET_ACTIVE: + return + user_ldap = LdapUser(uidNumber=self.uid_number) + base = True + access_refresh = True + mac_refresh = True if base: user_ldap.name = self.pseudo user_ldap.sn = self.pseudo