@@ -, +, @@ - Convert Auth_with_shibboleth to use dbic stanzas. --- C4/Auth_with_shibboleth.pm | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) --- a/C4/Auth_with_shibboleth.pm +++ a/C4/Auth_with_shibboleth.pm @@ -21,6 +21,7 @@ use Modern::Perl; use C4::Debug; use C4::Context; +use Koha::Database; use Carp; use CGI; @@ -94,16 +95,12 @@ sub checkpw_shib { my $config = _get_shib_config(); $debug and warn "User Shibboleth-authenticated as: $match"; - # Does the given shibboleth attribute value ($match) match a valid koha user ? - my $sth = $dbh->prepare( - "select cardnumber, userid from borrowers where $config->{matchpoint}=?" - ); - $sth->execute($match); - if ( $sth->rows ) { - my @retvals = $sth->fetchrow; - $retnumber = $retvals[0]; - $userid = $retvals[1]; - return ( 1, $retnumber, $userid ); + # Does the given shibboleth attribute value ($match) match a valid koha user ? + my $borrower = + Koha::Database->new()->schema()->resultset('Borrower') + ->find( { $config->{matchpoint} => $match } ); + if ( defined($borrower) ) { + return ( 1, $borrower->get_column('cardnumber'), $borrower->get_column('userid') ); } # If we reach this point, the user is not a valid koha user --