From 1183573b65e2871775665b84fab789f89c676c7c Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 2 May 2019 00:31:13 +0200 Subject: [PATCH] Make cn, uid, uname the same --- dal/ungleich_ldap.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dal/ungleich_ldap.py b/dal/ungleich_ldap.py index 74f102f..3ff81f5 100644 --- a/dal/ungleich_ldap.py +++ b/dal/ungleich_ldap.py @@ -91,14 +91,16 @@ class LdapManager: logger.debug("{uid} does not exist. Using it".format(uid=uidNumber)) self._set_max_uid(uidNumber) try: - conn.add( - ("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=user), + uid = user.encode("utf-8") + conn.add("uid={uid},{customer_dn}".format( + uid=uid, customer_dn=settings.LDAP_CUSTOMER_DN + ), ["inetOrgPerson", "posixAccount", "ldapPublickey"], { - "uid": [user.encode("utf-8")], + "uid": [uid], "sn": [lastname.encode("utf-8")], "givenName": [firstname.encode("utf-8")], - "cn": ["{} {}".format(firstname, lastname).encode("utf-8")], + "cn": [uid], "displayName": ["{} {}".format(firstname, lastname).encode("utf-8")], "uidNumber": [str(uidNumber)], "gidNumber": [str(settings.LDAP_CUSTOMER_GROUP_ID)],