rwinch / spring-ldap

Apache License 2.0
0 stars 0 forks source link

LDAP-313: Ability to persist new entries without precoding DnAttribute annotations to allow location flexibility #35

Open rwinch opened 10 years ago

rwinch commented 10 years ago

Original Reporter: aharonyh Environment: Not Specified Version: Not Specified Migrated From: https://jira.spring.io//browse/LDAP-313 Sometimes, applications need to create new entries (of the same type) in different locations. However, the DefaultObjectDirectoryMapper.getCalculatedId(Object entry) method relies on the DnAttribute annotations to determine the location in case the ID is null (new entry). An attempt to set the ID to the correct location yields an exception as the entry does not exist (of course).

This means that the entry is pinned to a predefined/precoded location and can no longer be used in another location. Example: Directory that contains multiple organisations, or even departments. There is no way to persist a new user record in more than one location.

There should be a way to provide a base DN prior to persisting it. The calculation method should check for the base DN and only if it is missing, try to use the DnAttribute annotations.

Thanks in advance.