The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

  use User::Config;

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

DESCRIPTION

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.

ATTRIBUTES

scope

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

userattr

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

ns2attribute

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.

searchstr

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)>>.

ldap

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>>.

default_objectclass

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".

METHODS

<$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

SEE ALSO

AUTHOR

Benjamin Tietz <benjamin@micronet24.de>

COPYRIGHT AND LICENSE

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.