From 4121f6924529c9792383b5c2484a3dc1be72c551 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 25 Mar 2009 22:06:00 +0000 Subject: [PATCH] finish mappings from UMgr-LDAP.conf --- lib/LDAP/Koha.pm | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/lib/LDAP/Koha.pm b/lib/LDAP/Koha.pm index c6e18c5..e8df942 100644 --- a/lib/LDAP/Koha.pm +++ b/lib/LDAP/Koha.pm @@ -33,22 +33,25 @@ my $dbh = DBI->connect($dsn . $database, $user,$passwd, { RaiseError => 1, AutoC # attributes which won't pass through DBI my $sql_select = q{ select - userid as uid, - firstname as givenName, - surname as sn, - concat( - firstname, - ' ', - surname - ) as cn, - cardnumber as otherPager, - email as mail + trim(userid) as uid, + firstname as givenName, + surname as sn, + concat(firstname,' ',surname) as cn, + + -- SAFEQ specific mappings from UMgr-LDAP.conf + concat(firstname,' ',surname) as displayName, + cardnumber as otherPager, + email as mail, + categorycode as organizationalUnit, + borrowernumber as objectGUID, + concat('/home/',borrowernumber) as homeDirectory from borrowers }; # needed for where clause my $sql_ldap_mapping = { - 'userid' => 'uid', + 'userid' => 'uid', + 'borrowernumber' => 'objectGUID', }; # attributes which are same for whole set, but somehow @@ -137,8 +140,9 @@ sub search { } } } elsif ( $how eq 'present' ) { - push @limits, __sql_column( $filter->{$how} ) . ' IS NOT NULL'; - ## XXX add and length(foo) > 0 to avoid empty strings? + my $name = __sql_column( $filter->{$how} ); + push @limits, "$name IS NOT NULL and length($name) > 1"; + ## XXX length(foo) > 1 to avoid empty " " strings } else { warn "UNSUPPORTED: how $how ",dump( $filter ); } -- 2.20.1