View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Benjamin Tietz > User-Config-DB-Ldap-0.01_01 > User::Config::DB::Ldap



Annotate this POD

Module Version: 0.01_01   Source  


User::Config::DB::Ldap - Store User-Configuration in an LDAP-directory.


  use User::Config;

  my $uc = User::Config->instance;
  $uc->db("LDAP",  { table => "user", db => "dbi:SQLite:user.sqlite" });


This is a database-backend for User::Config. It will store all values within an LDAP-directory. The options dataclass will be used to determine the LDAP-schema to use. If needed, this will be added on demand.



The scope to use during searches. It might be one of "one", "base" or "sub" - which is the default.


The attribute of the ldap-entry, which is used to determine the corresponding user. This defaults to uid.


to generate the name of an attribute out of the namespace and name of a given option, some kind of transition is needed.

By default the '::' seperating the namespace will be replaced by an underscore; as well as an underscore will be used to concatenate the namespace and the options name.

If another behaviour is needed, a corresponding sub-ref can be used here. It will be called as <$db-ns2attribute($namespace, $name, $context)>> and should return the needed attribute's name.


If a search for an element has to be performed, a corresponding query is generated.

By default, a search for an element, where the attribute set in userattr is equal to the current's context user will be performed.

To generate another searchstr, searchstr can be set to an sub-ref. This will be called like <$db-searchstr($namespace, $option_name, $user, $context)>>.


If there is a preared LDAP-connection is available, this can be set using the ldap-attribute. It will accept a sub-ref returning a bound connection. This will be called as <$db-ldap($user, $modification, $context)>>, where $modification will indicate, wether this connection will be used to modify items in the database. The connection then has to be returned. Care has to be taken not to return a connection with different user-privileges.

host, binddn, bindpwd and rootdn

If no ldap-attribute is given, alternativly these parameters can be given to bind to a server on every request. host must be set to a corresponding URI and is, like rootdn in this case mandatory.

Read-only requests will be performed using an anonymous bind. Modification will do a bind on the connection in advance.

HINT: even, if ldap is given, these can be set and being used in the given sub, using eg <$self-host>>.


If an option should be set, whithout any entry for the given user being present, a new entry will be created. The entry will use the objectclass given by default_objectclass which defaults to "posixAccount".


<$db-set($package, $user, $option_name, $context, $value)>>

assigns the value for the given user to the option within a package. See User::Config::DB

<$db-isset($package, $user, $option_name, $context)>>

Checks wether the option was set. See User::Config::DB



Benjamin Tietz <>


Copyright (C) 2011 by Benjamin Tietz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: