1 package NCIP::Handler::LookupUser;
5 NCIP::Handler::LookupUser
9 Not to be called directly, NCIP::Handler will pick the appropriate Handler
10 object, given a message type
21 our @ISA = qw(NCIP::Handler);
28 # Given our xml document, lets find our userid
30 $xmldoc->getElementsByTagNameNS( $self->namespace(),
31 'UserIdentifierValue' );
32 my $xpc = XML::LibXML::XPathContext->new;
33 $xpc->registerNs( 'ns', $self->namespace() );
36 # We may get a password, username combo instead of userid
37 # Need to deal with that also
38 my $root = $xmldoc->documentElement();
40 $xpc->findnodes( '//ns:AuthenticationInput', $root );
43 foreach my $node (@authtypes) {
45 $xpc->findnodes( './ns:AuthenticationInputType', $node );
47 $xpc->findnodes( './ns:AuthenticationInputData', $node );
48 if ( $class->[0]->textContent eq 'Barcode Id' ) {
49 $barcode = $value->[0]->textContent;
51 elsif ( $class->[0]->textContent eq 'PIN' ) {
52 $pin = $value->[0]->textContent;
59 # We may get a password, username combo instead of userid
60 # Need to deal with that also
62 my $user = NCIP::User->new(
63 { userid => $user_id->textContent(), ils => $self->ils } );
66 # if we have blank user, we need to return that
67 # and can skip looking for elementtypes
68 if ( $user->userdata->{'borrowernumber'} eq '' ) {
70 $vars->{'messagetype'} = 'LookupUser';
71 $vars->{'error_detail'} = "Borrower not found";
72 my $output = $self->render_output( 'problem.tt', $vars );
76 my $root = $xmldoc->documentElement();
78 $xpc->findnodes( 'ns:LookupUser/UserElementType/Value', $root );
80 #set up the variables for our template
82 $vars->{'messagetype'} = 'LookupUserResponse';
83 $vars->{'elements'} = \@elements;
84 $vars->{'user'} = $user;
85 my $output = $self->render_output( 'response.tt', $vars );