spring-ldap
spring-ldap copied to clipboard
findAll() ignoring base attribute from @Entry
SimpleLdaprepository's findAll() wich in turn calls
ldapOperations.findAll(clazz);
Seems to ignore any base set in the @Entry class
/**
* {@inheritDoc}
*/
@Override
public <T> List<T> findAll(Class<T> clazz) {
return findAll(LdapUtils.emptyLdapName(),
getDefaultSearchControls(defaultSearchScope, RETURN_OBJ_FLAG, ALL_ATTRIBUTES),
clazz);
}
Wich results in that the base attribute in the @Entity doens't work for LdapRepositorys findAll() method.
Also seeing this on any find methods
I am also seeing this. Has this really been open for over a year? It seems like a fairly major bug in Spring LDAP that should be more clearly documented if it can't be fixed more easily.
Should ObjectDirectoryMapper
override the baseFilter
when calling ObjectDirectoryMapper#filterFor
(e.g. should DefaultObjectDirectoryMapper#addManagedClass
be handling this)? Or should we be checking for class annotations in https://github.com/spring-projects/spring-ldap/blob/master/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java#L1814?
@lewisheadden I've fixed this at https://github.com/bhuism/spring-ldap.
I'm also observing this behaviour. Any chance to get this fixed?
#469
I issued a pull request to fix this issue with findAll(Class<T> clazz)
#470
Ok, if the API can't be changed for the foreseeable future, here is at least a fix so that the correct search is performed.
Any idea when the pull request will be accepted ?
Will #470 ever get merged? If not, what would the recommended way of getting around the issue?
Should
ObjectDirectoryMapper
override thebaseFilter
when callingObjectDirectoryMapper#filterFor
@lewisheadden, I don't think so. Ultimately, DirContext#search
keeps the concepts of base
and filter
separate and Spring LDAP should probably preserve that in its API.
Or should we be checking for class annotations in https://github.com/spring-projects/spring-ldap/blob/master/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java#L1814?
This could work, though it seems to me that this work is already done in ObjectDirectoryMapper
and it would be nice to maintain the abstraction so it can be switched out.
I'm inclined to introduce something that allows LdapTemplate
to derive the base from ObjectDirectoryMapper
, though I still wonder the right way to do it. LDAP 2.4's baseline is JDK 8, so adding an interface method to ObjectDirectoryMapper
is now an option.
Any idea when the pull request will be accepted ?