Closed xunto closed 6 years ago
Your intuition is right: ldap_rename does set deleteoldrdn
to 1 by default. Unfortunately, it's hard coded right now. But I'm willing to change it in the future.
Could you send me a detailed example about what you're trying to achieve? (What's the entry looks like before and after the modification)
Record (ldif):
version: 1
dn: cn=b1d10054-14df-4096-97e1-ea8fb7032040,ou=Users,dc=herzen,dc=spb,dc=ru
objectClass: shadowAccount
objectClass: posixAccount
objectClass: domainRelatedObject
objectClass: inetOrgPerson
associatedDomain: students.ok
cn: b1d10054-14df-4096-97e1-ea8fb7032040
gidNumber: 1000
homeDirectory: /home/100393
sn:: %hidden%
uid: 100393
uidNumber: 330604
description:: Q9GC0YPQtNC10L3RgiAo0J7QkSk=
displayName:: %hidden%
employeeNumber: %hidden%
employeeType: students
givenName:: 0JrQvtC90YHRgtCw0L3RgtC40L0g0J/QsNCy0LvQvtCy0LjRhw==
mail: %hidden%
mobile: %hidden%
userPassword:: %hidden%
Code:
async def rename(connection: AIOLDAPConnection, uid)
record: LDAPEntry = await connection.search(
"cn=b1d10054-14df-4096-97e1-ea8fb7032040,ou=Users,dc=herzen,dc=spb,dc=ru",
bonsai.LDAPSearchScope.BASE,
attrlist=[],
sizelimit=1
)[0]
await record.rename(f"uid={uid},ou=Users,dc=herzen,dc=spb,dc=ru")
This should work.
Thanks, I'll check out.
@noirello Is there some workaround for now? Like a way to send raw request to ldap?
Sorry, but currently there's no workaround for it. :(
Oh, okay. :(
v1.0.0 is out and LDAPEntry's rename method got a delete_old_rdn
param.
Hi. I'm not sure that it is but it seems so. So it raise exception about object class violation ("cn" needed) when I try to rename entry.
Could you please explain how to: