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

(-)C4/SIP/Sip/MsgType.pm.orig (+22 lines)
Lines 20-25 use CGI qw ( -utf8 ); Link Here
20
use C4::Auth qw(&check_api_auth);
20
use C4::Auth qw(&check_api_auth);
21
21
22
use Koha::Patron::Attributes;
22
use Koha::Patron::Attributes;
23
use Koha::Plugins::Handler;
23
24
24
use UNIVERSAL::can;
25
use UNIVERSAL::can;
25
26
Lines 469-474 sub build_patron_status { Link Here
469
    return $resp;
470
    return $resp;
470
}
471
}
471
472
473
# Return true if the patron is valid for the particular client
474
# that issued the SIP2 request.
475
476
sub check_patron {
477
    my ( $patron, $server ) = @_;
478
479
    if ( $patron ) {
480
        my $plugin_class = $server->{account}->{plugin_class};
481
	if ($plugin_class) {
482
	    return Koha::Plugins::Handler->run({
483
		    class  => $plugin_class,
484
		    method => 'sip2_validate_patron',
485
		    params => { patron => $patron, server => $server },
486
		});
487
	}
488
    }
489
    return 1;
490
}
491
472
sub handle_patron_status {
492
sub handle_patron_status {
473
    my ( $self, $server ) = @_;
493
    my ( $self, $server ) = @_;
474
    my $ils = $server->{ils};
494
    my $ils = $server->{ils};
Lines 480-485 sub handle_patron_status { Link Here
480
500
481
    $ils->check_inst_id( $fields->{ (FID_INST_ID) }, "handle_patron_status" );
501
    $ils->check_inst_id( $fields->{ (FID_INST_ID) }, "handle_patron_status" );
482
    $patron = $ils->find_patron( $fields->{ (FID_PATRON_ID) } );
502
    $patron = $ils->find_patron( $fields->{ (FID_PATRON_ID) } );
503
    $patron = undef unless ( check_patron ( $patron, $server ) );
483
    $resp = build_patron_status( $patron, $lang, $fields, $server );
504
    $resp = build_patron_status( $patron, $lang, $fields, $server );
484
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
505
    $self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );
485
    return (PATRON_STATUS_REQ);
506
    return (PATRON_STATUS_REQ);
Lines 933-938 sub handle_patron_info { Link Here
933
    $end          = $fields->{ (FID_END_ITEM) };
954
    $end          = $fields->{ (FID_END_ITEM) };
934
955
935
    $patron = $ils->find_patron($patron_id);
956
    $patron = $ils->find_patron($patron_id);
957
    $patron = undef unless ( check_patron ( $patron, $server ) );
936
958
937
    $resp = (PATRON_INFO_RESP);
959
    $resp = (PATRON_INFO_RESP);
938
    if ($patron) {
960
    if ($patron) {

Return to bug 16694