Skip to content

fixed base not being used for findAll search #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,7 @@ public <T> List<T> findAll(Name base, SearchControls searchControls, final Class
*/
@Override
public <T> List<T> findAll(Class<T> clazz) {
return findAll(LdapUtils.emptyLdapName(),
return findAll(this.odm.base(clazz),
getDefaultSearchControls(defaultSearchScope, RETURN_OBJ_FLAG, ALL_ATTRIBUTES),
clazz);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.springframework.LdapDataEntry;
import org.springframework.ldap.filter.Filter;
import org.springframework.ldap.odm.annotations.Entry;

/**
* The ObjectDirectoryMapper keeps track of managed class metadata and is used by {@link org.springframework.ldap.core.LdapTemplate}
Expand Down Expand Up @@ -95,4 +96,12 @@ public interface ObjectDirectoryMapper {
* @return all relevant attribute names used in the given class (either for reading from LDAP or for writing to LDAP or both)
* @throws org.springframework.ldap.NamingException on error. */
String[] manageClass(Class<?> clazz);

/**
* Get the base DN corresponding to the {@link Entry#base} property
*
* @param clazz the clazz
* @return the {@link Name} representing the base DN
*/
Name base(Class<?> clazz);
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ private EntityData addManagedClass(Class<?> managedClass) {
return newValue;
}

@Override
public Name base(Class<?> clazz) {
return this.getEntityData(clazz).metaData.getBase();
}

private void verifyConversion(Class<?> managedClass, Field field, AttributeMetaData attributeInfo) {
Class<?> jndiClass = attributeInfo.getJndiClass();
Class<?> javaClass = attributeInfo.getValueClass();
Expand Down