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.
<$db-
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.
userattr
To generate another searchstr, searchstr can be set to an sub-ref. This will be called like <$db-searchstr($namespace, $option_name, $user, $context)>>.
searchstr
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.
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.
ldap
host
rootdn
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>>.
<$self-
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".
default_objectclass
assigns the value for the given user to the option within a package. See User::Config::DB
Checks wether the option was set. See User::Config::DB
Benjamin Tietz <benjamin@micronet24.de>
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.
To install User::Config::DB::Ldap, copy and paste the appropriate command in to your terminal.
cpanm
cpanm User::Config::DB::Ldap
CPAN shell
perl -MCPAN -e shell install User::Config::DB::Ldap
For more information on module installation, please visit the detailed CPAN module installation guide.