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

NAME

Dancer::Plugin::LDAP::Handle - subclassed Net::LDAP object

SYNOPSIS

METHODS

quick_select

quick_select performs a search in the LDAP directory.

The simplest form is to just specify the filter:

    ldap->quick_select({objectClass => 'inetOrgPerson'});

This retrieves all records of the object class inetOrgPerson.

A specific record can be fetched by using the distinguished name (DN) as only key in the hash reference:

    ldap->quick_select({dn => 'uid=racke@linuxia.de,dc=linuxia,dc=de'});

The base of your search can be passed as first argument, otherwise the base defined in your settings will be used.

    ldap->quick_select('dc=linuxia,dc=de', {objectClass => 'inetOrgPerson'});

You may add any options supported by the Net::LDAP search method, e.g.:

    ldap->quick_select('dc=linuxia,dc=de', {objectClass => 'inetOrgPerson'},
        scope => 'one');

Attributes

In addition, there is a values option which determines how values for LDAP attributes are fetched:

first

First value of each attribute.

last

Last value of each attribute.

asref

Values as array reference.

quick_insert $dn $ref %opts

Adds an entry to LDAP directory.

    ldap->quick_insert('uid=racke@linuxia.de,ou=people,dc=linuxia,dc=de',
        {cn => 'racke@linuxia.de',
         uid => 'racke@linuxia.de',
         givenName = 'Stefan',
         sn => 'Hornburg',
         c => 'Germany',
         l => 'Wedemark',
         objectClass => [qw/top person organizationalPerson inetOrgPerson/],
        }

The fields which hold empty strings or undefined values will not be inserted, but just ignored.

quick_compare $type $a $b $pos

quick_update

Modifies LDAP entry with distinguished name $dn by replacing the values from $replace. If the value is the empty string, delete the attribute.

Returns DN in case of success.

    ldap->quick_update('uid=racke@linuxia.de,dc=linuxia,dc=de', {l => 'Vienna'});

quick_delete

Deletes entry given by distinguished name $dn.

    ldap->quick_delete('uid=racke@linuxia.de,dc=linuxia,dc=de');

rename

Change distinguished name (DN) of a LDAP record from $old_dn to $new_dn.

base

Returns base DN, optionally prepending relative DN from @rdn.

    ldap->base

    ldap->base('uid=racke@linuxia.de');

rebind

Rebind with credentials from settings.

dn_split $dn %options

dn_join $rdn1 $rdn2 ...

dn_escape

Escapes values in DN $dn and returns the altered string.

dn_unescape

Unescapes values in DN $dn and returns the altered string.

dn_value $dn $pos $attribute

Returns DN attribute value from $dn at position $pos, matching attribute name $attribute.

$pos and $attribute are optional.

Returns undef in the following cases:

* invalid DN * $pos exceeds number of entries in the DN * attribute name doesn't match $attribute

Examples:

    ldap->dn_value('ou=Testing,dc=linuxia,dc=de');

    Testing

    ldap->dn_value('ou=Testing,dc=linuxia,dc=de', 1);

    linuxia

DN

Our methods return and expect unescaped DN's.

AUTHOR

Stefan Hornburg (Racke), <racke@linuxia.de>

ACKNOWLEDGEMENTS

See "ACKNOWLEDGEMENTS" in Dancer::Plugin::LDAP

LICENSE AND COPYRIGHT

Copyright 2010-2013 Stefan Hornburg (Racke) <racke@linuxia.de>.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

SEE ALSO

Dancer::Plugin::LDAP

Dancer

Net::LDAP