rwinch / spring-ldap

Apache License 2.0
0 stars 0 forks source link

LDAP-152: New filters for searching based on a attribute being "present" #23

Closed rwinch closed 8 years ago

rwinch commented 15 years ago

Original Reporter: jordanh Environment: Not Specified Version: 1.3.0-RC1 Migrated From: https://jira.spring.io//browse/LDAP-152 According to RFC2254 Ldap supports search filters based on an attribute being "present". The filter is in the form of "(attr=*)". Currently spring-ldap 1.2.1 does not support this filter in a clean way.

The filter can be achieved by using a LikeFilter as follows:

{code:title=Bar.java|borderStyle=solid} LikeFilter likeFilter = new LikeFilter("bar", "*")); {code}

However, this is hackish and is relying on the undocumented internal workings of the LikeFilter to split the value on the "", effectively removing the "" and then appending on a "*" to achieve the "Like" behavior. Should the LikeFilter change in a future release users trying to get "present" behavior from the LikeFilter could be broken.

Therefore, I propose two new filter types called "PresentFilter" and a "NotPresentFilter".

I will attach source code for these two classes.

rwinch commented 15 years ago

marthursson said: Added the proposed classes.