|
@@ -180,13 +180,16 @@ class Member(CoinLdapSyncMixin, AbstractUser):
|
|
|
ldap_user = LdapUser.objects.get(pk=self.username)
|
|
|
|
|
|
if creation:
|
|
|
- max_uid_number = LdapUser.objects.order_by(
|
|
|
- '-uidNumber')[0].uidNumber
|
|
|
+ users = LdapUser.objects
|
|
|
+ if users.exists():
|
|
|
+ uid_number = users.order_by('-uidNumber')[0].uidNumber + 1
|
|
|
+ else:
|
|
|
+ uid_number = settings.LDAP_USER_FIRST_UID
|
|
|
ldap_user = LdapUser()
|
|
|
ldap_user.pk = self.username
|
|
|
ldap_user.uid = self.username
|
|
|
ldap_user.nick_name = self.username
|
|
|
- ldap_user.uidNumber = max_uid_number + 1
|
|
|
+ ldap_user.uidNumber = uid_number
|
|
|
|
|
|
ldap_user.last_name = self.last_name
|
|
|
ldap_user.first_name = self.first_name
|