View | Details | Raw Unified | Return to bug 8993
Collapse All | Expand All

(-)a/C4/LDAPTransform/RepeatableValues.pm (-13 / +14 lines)
Lines 4-27 use warnings; Link Here
4
use strict;
4
use strict;
5
5
6
my $mapping = { qw/
6
my $mapping = { qw/
7
givenName	firstname
7
    givenName       firstname
8
sn		surname
8
    sn              surname
9
uid		userid
9
    uid             userid
10
mail		email
10
    mail            email
11
    categorycode    categorycode
12
    branchcode      branchcode
11
/ };
13
/ };
12
14
13
sub get_borrower {
15
sub get_borrower {
14
	my $ldap_entry = shift;
16
    my $ldap_entry = shift;
15
	$ldap_entry->isa('Net::LDAP::Entry') or die "argument to transform get_borrower is not Net::LDAP::Entry";
17
    $ldap_entry->isa('Net::LDAP::Entry') or die "argument to transform get_borrower is not Net::LDAP::Entry";
16
18
17
	my $user = { column => {} };
19
    my $user = { column => {} };
18
20
19
	while (my ($from, $to) = each %$mapping) {
21
    while (my ($from, $to) = each %$mapping) {
20
		my @vals = $ldap_entry->get_value( $from );
22
        my @vals = $ldap_entry->get_value( $from );
21
		$user->{column}->{$to} = $vals[0];
23
        $user->{column}->{$to} = $vals[0];
22
	}
24
    }
23
25
24
	return $user;
26
    return $user;
25
}
27
}
26
28
27
1;
29
1;
28
- 

Return to bug 8993