6 |
use lib 'lib'; |
use lib 'lib'; |
7 |
|
|
8 |
use Jifty; |
use Jifty; |
9 |
use Net::LDAP; |
use A3C::LDAP; |
10 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
11 |
use Getopt::Long; |
use Getopt::Long; |
12 |
|
|
17 |
'limit=i', => \$limit, |
'limit=i', => \$limit, |
18 |
); |
); |
19 |
|
|
|
my $ldap_config = Jifty->config->app('LDAP'); |
|
|
Jifty->log->debug( "config->app(LDAP) = ",dump( $ldap_config ) ); |
|
|
|
|
|
my $ldap = Net::LDAP->new( $ldap_config->{Server} ) or die "$@"; |
|
|
|
|
|
# an anonymous bind |
|
|
#my $mesg = $ldap->bind; |
|
|
my $mesg = $ldap->bind( $ldap_config->{DN}, password => $ldap_config->{Password} ); |
|
|
|
|
|
Jifty->log->info("Connected to ", $ldap_config->{Server}, " with DN ", $ldap_config->{DN}); |
|
|
|
|
20 |
# perform a search |
# perform a search |
21 |
$mesg = $ldap->search( |
my $mesg = A3C::LDAP->search( |
22 |
base => "dc=skole,dc=hr", |
base => "dc=skole,dc=hr", |
23 |
# filter => "(&(sn=Barr) (o=Texas Instruments))", |
# filter => "(&(sn=Barr) (o=Texas Instruments))", |
24 |
filter => "(objectClass=hrEduPerson)", |
filter => "(objectClass=hrEduPerson)", |