I get the error attribute 'sn' is read only In ldp.exe from this user I can modify other users, I have privileges and their 'sn' attribute isn't read only, but in python is, why?
while True:
pesel = input("Wprowadź PESEL użytkownika dla którego chcesz zmienić nazwisko: ")
if not is_valid_serial_number(pesel):
print("Nieprawidłowy numer PESEL.")
continue
break
ldap_connection.search(search_base=f'dc=test,dc=local', search_filter=f'(serialNumber={pesel})', search_scope=SUBTREE, attributes=['sAMAccountName', 'givenName', 'sn', 'serialNumber','cn'])
entry = ldap_connection.entries[0]
dn = entry.entry_dn
print(dn)
new_last_name = input("Wprowadź nowe nazwisko: ")
print(entry.entry_attributes_as_dict)
old_last_name = entry['sn'].value
print(f"Potwierdź, czy chcesz zmienić nazwisko dla użytkownika {entry.sAMAccountName.value} z {old_last_name} na {new_last_name}.")
confirmation = input("1. Tak\n2. Nie\nWybierz opcję: ")
if confirmation == '1':
entry.sn = new_last_name
ldap_connection.modify(entry.entry_dn, {'sn': [(MODIFY_REPLACE, [new_last_name])]})
print("Nazwisko użytkownika zostało zmienione.")
else:
print("Anulowano zmianę nazwiska.")
ldap_connection.unbind()`
I checked ldap configuration and ldap privileges for user I tried modify other attributes like description but same resultat I tried to:
but it's not about modifications dn
my goal is to edit an existing user, his last name - sn
I found a solution.