Search for objects
You are able to search for objects stored in your database (by default a ldap
server) directly by entering one or more pieces of known information about these
objects. These information can be one or more values of all attributes which
belongs to this object. The way the search string must be built is dependent on
the backend. By default this is a ldap server and you have to provide a string
(also known as the "filter") which complies to the ldap standard.
Basic examples
The simplest way to search for an object is to build a filter which contains the
key of the attribute we search for and the value concatenated by an equal sign:
sn=test
If there is more than one object whose sn attribute is "test" then you will get
a list of these objects. To be precise, you get a list of their paths or according
to the ldap convention: the distinguish names (dn).
You can also include wildcards to match all objects which contain this string:
sn=*test*
Advanced examples
If you want to limit the result to objects which fulfill several conditions, you
have to provide a string similar to this:
(&(sn=test)(gidnumber=100))
This filter lets the ldap server search for objects whose sn is "test" and whose
uidnumber is "100". Each key=value pair must be enclosed in brackets as well as
the whole string. The operation is always specified first (here "&" for the "and"
operation). Another possible operation would be "|" for the "or" operation.
You can also combine several operations and conditions:
(&(|(uid=foo)(uid=bar))(objectclass=posixaccount))
The result will be all objects whose uid is either "foo" or "bar" and whose
objectclass attributes contains "posixaccount".