Bugzilla – Attachment 20885 Details for
Bug 10667
ILS-DI: AuthenticatePatron should also work with cardnumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10667: Allow authentication with cardnumber for ILS-DI
Bug-10667-Allow-authentication-with-cardnumber-for.patch (text/plain), 3.69 KB, created by
Katrin Fischer
on 2013-09-08 19:49:26 UTC
(
hide
)
Description:
Bug 10667: Allow authentication with cardnumber for ILS-DI
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2013-09-08 19:49:26 UTC
Size:
3.69 KB
patch
obsolete
>From e9e5183acf5bc9907a7b0e246d57800002ca68d3 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <Katrin.Fischer.83@web.de> >Date: Sun, 8 Sep 2013 21:42:04 +0200 >Subject: [PATCH] Bug 10667: Allow authentication with cardnumber for ILS-DI > >Test authentication via ILS-DI: >- with userid and password >- with userid and wrong password >- with cardnumber and password >- with cardnumber and wrong password >... > >Before the patch only userid will authenticate the patron. >After the patch was applied, userid and cardnumber will work. > >To test: >- Run t/db_dependent/ILSDI_Services.t - all tests should pass. >--- > C4/ILSDI/Services.pm | 24 ++++++++++-------------- > koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt | 2 +- > t/db_dependent/ILSDI_Services.t | 2 -- > 3 files changed, 11 insertions(+), 17 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index eff483d..7941a70 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -313,28 +313,24 @@ the patron. > Parameters: > > - username (Required) >- user's login identifier >+ user's login identifier (userid or cardnumber) > - password (Required) >- user's password >+ user's password > > =cut > > sub AuthenticatePatron { > my ($cgi) = @_; >- >- # Check if borrower exists, using a C4::Auth function... >- unless( C4::Auth::checkpw( C4::Context->dbh, $cgi->param('username'), $cgi->param('password') ) ) { >+ my ($status, $cardnumber, $userid) = C4::Auth::checkpw( C4::Context->dbh, $cgi->param('username'), $cgi->param('password') ); >+ if ( $status ) { >+ # Get the borrower >+ my $borrower = GetMember( cardnumber => $cardnumber ); >+ my $patron->{'id'} = $borrower->{'borrowernumber'}; >+ return $patron; >+ } >+ else { > return { code => 'PatronNotFound' }; > } >- >- # Get the borrower >- my $borrower = GetMember( userid => $cgi->param('username') ); >- >- # Build the hashref >- my $patron->{'id'} = $borrower->{'borrowernumber'}; >- >- # ... and return his ID >- return $patron; > } > > =head2 GetPatronInfo >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt >index bee032e..18bbb00 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt >@@ -388,7 +388,7 @@ > <h4>Parameters</h4> > <dl> > <dt><strong>username</strong> (Required)</dt> >- <dd>user's login identifier</dd> >+ <dd>user's login identifier (userid or cardnumber)</dd> > <dt><strong>password</strong> (Required)</dt> > <dd>user's password</dd> > </dl> >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index 5ceebaa..505b7e6 100644 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -72,7 +72,6 @@ my $borrower = GetMember( borrowernumber => $borrowernumber ); > is($reply->{'id'}, $borrowernumber, "userid is not case sensitive - Patron authenticated"); > is($reply->{'code'}, undef, "Error code undef"); > >-TODO: { local: $TODO = "Can't use cardnumber for authentication with ILS-DI yet."; > $query->param('username',$borrower->{'cardnumber'}); > $reply = C4::ILSDI::Services::AuthenticatePatron($query); > is($reply->{'id'}, $borrowernumber, "cardnumber and password - Patron authenticated"); >@@ -88,7 +87,6 @@ TODO: { local: $TODO = "Can't use cardnumber for authentication with ILS-DI yet. > $reply = C4::ILSDI::Services::AuthenticatePatron($query); > is($reply->{'code'}, 'PatronNotFound', "non-existing cardnumer/userid - PatronNotFound"); > is($reply->{'id'}, undef, "id undef"); >- } > > } > >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10667
:
20884
|
20885
|
20888
|
20889
|
20998
|
21007
|
21064
|
21065
|
21067