NAME
Connector::Proxy::Net::LDAP::Single
DESCRIPTION
Search and return a single item from the repository. Attributes from the ldap entry can be mapped to the returned structure using a map.
The connector will die if multiple entries are found.
configuration options
See Connector::Proxy::Net::LDAP for basic configuration options
The class needs a map of attribute names to map between the returned hash and the names of the ldap attributes.
connector:
LOCATION:...
....
attrmap:
certificate:usercertificate
department:ou
Warning: Do not set the attr property
accessor methods
get
Not supported.
get_hash
You need to define a map to assign the resulting ldap attributes to the returned hash structure. The maps keys remain keys whereas the value is set to the value of the ldap attribute with that name. Multivalued attributes are truncated to the first entry by default. To get them as array ref, set the deep parameter to true { deep =
1}>.
Note: the special name pkey is reserved and contains the dn of the entry.
get_keys
Return the keys which are set in the resulting hash. Keys that do not have a matching attribute value are not set.
get_list / get_size
Not supported.
set
Set attributes of a node, if configured will create a non-exisiting node. The set method requires a hash as value parameter.
You can control how existing attributes in the node are treated and if missing nodes are created on the fly. See Connector::Proxy::Net::LDAP for details.
Set multiple attributes on an existing node
The connector first does a search similar to its get
method based on the passed filter arguments. If exactly one entry is found, it works like the inverse of the get_hash method. It needs an attributemap and maps all values from the input hash to the ldap attributes. Only keys which are present in the input array are handled.
Set operation when the dn is known
If you used another ldap operation before and already know the dn, you can pass this dn as parameter pkey to the set method.
$conn->set('John Doe', { mail => <new mail address>}, { pkey => $dn });
The dn is returned by example by the get_hash
method.
Set operation with node autocreation
To enable the automated creation of missing nodes, look for the corresponding section in the base class Connector::Proxy::Net::LDAP.