Make cn, uid, uname the same

This commit is contained in:
PCoder 2019-05-02 00:31:13 +02:00
parent d0cb515cd9
commit 1183573b65

View file

@ -91,14 +91,16 @@ class LdapManager:
logger.debug("{uid} does not exist. Using it".format(uid=uidNumber)) logger.debug("{uid} does not exist. Using it".format(uid=uidNumber))
self._set_max_uid(uidNumber) self._set_max_uid(uidNumber)
try: try:
conn.add( uid = user.encode("utf-8")
("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=user), conn.add("uid={uid},{customer_dn}".format(
uid=uid, customer_dn=settings.LDAP_CUSTOMER_DN
),
["inetOrgPerson", "posixAccount", "ldapPublickey"], ["inetOrgPerson", "posixAccount", "ldapPublickey"],
{ {
"uid": [user.encode("utf-8")], "uid": [uid],
"sn": [lastname.encode("utf-8")], "sn": [lastname.encode("utf-8")],
"givenName": [firstname.encode("utf-8")], "givenName": [firstname.encode("utf-8")],
"cn": ["{} {}".format(firstname, lastname).encode("utf-8")], "cn": [uid],
"displayName": ["{} {}".format(firstname, lastname).encode("utf-8")], "displayName": ["{} {}".format(firstname, lastname).encode("utf-8")],
"uidNumber": [str(uidNumber)], "uidNumber": [str(uidNumber)],
"gidNumber": [str(settings.LDAP_CUSTOMER_GROUP_ID)], "gidNumber": [str(settings.LDAP_CUSTOMER_GROUP_ID)],