I import reference to LDAP users and groups to my database. Therefore, I need to synch these users and groups periodically.
It is clear for me how to synch these object when LDAP supports Unique Identifier (UID).
For example Active Directory support objectGUID
attribute.
In this case when a user (or group) is moved to other place in LDAP tree and therefore its DN is changed I still can find it using UID and update the user.
What to do when LDAP does not support UID and DN is changed?
If I looking using old DN I can not find a user (or group) and need to remove the user.
But how can I distinguish between use cases when a user is moved to other place in the LDAP tree (its DN is changed) and a user is deleted from LDAP?
When it moved I should find it and update to new DN. When it is deleted I need to remove it.
I do not know how to do it.
Can I use the username (login name) for the user synchronization?
What I should use for LDAP group?