Fix for LDAP-25: Added an additional finder method to reference doc.
This commit is contained in:
@@ -253,7 +253,9 @@ import org.springframework.ldap.core.ContextMapper;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.support.DistinguishedName;
|
||||
import org.springframework.ldap.filter.AndFilter;
|
||||
import org.springframework.ldap.filter.EqualsFilter;
|
||||
import org.springframework.ldap.filter.WhitespaceWildcardsFilter;
|
||||
|
||||
public class PersonDaoImpl implements PersonDao {
|
||||
private LdapTemplate ldapTemplate;
|
||||
@@ -284,6 +286,12 @@ public class PersonDaoImpl implements PersonDao {
|
||||
return (Person) ldapTemplate.lookup(dn, getContextMapper());
|
||||
}
|
||||
|
||||
public List findByName(String name) {
|
||||
AndFilter filter = new AndFilter();
|
||||
filter.and(new EqualsFilter("objectclass", "person")).and(new WhitespaceWildcardsFilter("cn",name));
|
||||
return ldapTemplate.search(DistinguishedName.EMPTY_PATH, filter.encode(), getContextMapper());
|
||||
}
|
||||
|
||||
public List findAll() {
|
||||
EqualsFilter filter = new EqualsFilter("objectclass", "person");
|
||||
return ldapTemplate.search(DistinguishedName.EMPTY_PATH, filter.encode(), getContextMapper());
|
||||
|
||||
Reference in New Issue
Block a user