diff --git a/modified_time.txt b/modified_time.txt index 834684d96d143ddfd03aae0c33ce54b40d99dc10..e3dc995e2617ff179c9f8daf391c9dac294f3221 100644 --- a/modified_time.txt +++ b/modified_time.txt @@ -1 +1 @@ -2023-08-23 14:20:17 \ No newline at end of file +2023-08-24 14:42:05 \ No newline at end of file diff --git a/supr_ldap_krb.py b/supr_ldap_krb.py index aa6266facc3ad1b1da2ce649f7635a00f83c7081..9f7f3e9e7ed80fa04b1458867e7036d623599f62 100644 --- a/supr_ldap_krb.py +++ b/supr_ldap_krb.py @@ -259,31 +259,31 @@ class SUPR_LDAP: """Return a Person Attributes dictionary""" attrsPerson = {} - attrsPerson['objectclass'] = ['Swestore', 'inetorgperson', 'posixaccount'] - attrsPerson['description'] = str(m.id) + attrsPerson['objectclass'] = [('Swestore').encode('utf-8'), ('inetorgperson').encode('utf-8'), ('posixaccount').encode('utf-8')] + attrsPerson['description'] = str(m.id).encode('utf-8') attrsPerson['uidNumber'] = uidNumber attrsPerson['gidNumber'] = uidNumber - attrsPerson['gn'] = str((m.first_name).encode('utf-8')) - attrsPerson['sn'] = str((m.last_name).encode('utf-8')) - attrsPerson['cn'] = str((m.first_name + " " + m.last_name).encode('utf-8')) - attrsPerson['mail'] = str((m.email).encode('utf-8')) - attrsPerson['subject'] = str((m.subject).encode('utf-8')) - attrsPerson['lastModifiedTime'] = str(m.modified) - attrsPerson['homeDirectory'] = "/" + attrsPerson['gn'] = (m.first_name).encode('utf-8') + attrsPerson['sn'] = (m.last_name).encode('utf-8') + attrsPerson['cn'] = (m.first_name + " " + m.last_name).encode('utf-8') + attrsPerson['mail'] = (m.email).encode('utf-8') + attrsPerson['subject'] = (m.subject).encode('utf-8') + attrsPerson['lastModifiedTime'] = (m.modified).encode('utf-8') + attrsPerson['homeDirectory'] = ("/").encode('utf-8') # Will be updated to the correct yubikey value once yubikey is # integrated into SUPR (Not needed as of now) - attrsPerson['yubikey'] = "yubikey" + attrsPerson['yubikey'] = ("yubikey").encode('utf-8') # Need to check if centre_person_id comes from SUPR. If it clashes # with other UIDs then an alert mail needs to be sent to Admin about # the same. if m.centre_person_id: - attrsPerson['uid'] = str(m.centre_person_id) + attrsPerson['uid'] = str(m.centre_person_id).encode('utf-8') else: - attrsPerson['uid'] = self.getUID(m) + attrsPerson['uid'] = str(self.getUID(m)).encode('utf-8') - attrsPerson = {key:[v.encode("utf-8") if type(v) == str else v for v in values] for key, values in attrsPerson.items()} + #attrsPerson = {key:[v.encode("utf-8") if type(v) == str else v for v in values] for key, values in attrsPerson.items()} return attrsPerson @@ -489,8 +489,12 @@ class SUPR_LDAP: attrsPerson = self.createPersonAttrs(m, uidNumber) + self.logger.info("updateDeletePerson attrsPerson -- " + str(attrsPerson)) + personDN = "uid=" + str(attrsPerson['uid']) + "," + settings.peopleDN + self.logger.info("updateDeletePerson personDN -- " + str(personDN)) + if(result_data and self.personChanged(result_data, attrsPerson)): self.l.delete_s(personDN) ldif = modlist.addModlist(attrsPerson)