Bugzilla – Attachment 134910 Details for
Bug 30590
Add option for using AutoSelfCheckID and AutoSelfCheckPass values to log into OPAC self check-in module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30590: Use AutoSelfCheckID and AutoSelfCheckPass values to log into OPAC self check-in module
Bug-30590-Use-AutoSelfCheckID-and-AutoSelfCheckPas.patch (text/plain), 5.32 KB, created by
Wainui Witika-Park
on 2022-05-12 01:45:15 UTC
(
hide
)
Description:
Bug 30590: Use AutoSelfCheckID and AutoSelfCheckPass values to log into OPAC self check-in module
Filename:
MIME Type:
Creator:
Wainui Witika-Park
Created:
2022-05-12 01:45:15 UTC
Size:
5.32 KB
patch
obsolete
>From 5eddc3df076ea00d2bfbb553b2b7af28f270e86d Mon Sep 17 00:00:00 2001 >From: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> >Date: Tue, 10 May 2022 04:00:00 +0000 >Subject: [PATCH] Bug 30590: Use AutoSelfCheckID and AutoSelfCheckPass values > to log into OPAC self check-in module > >Test plan: >1) Set values in 'AutoSelfCheckID' and 'AutoSelfCheckPass' system preferences, and enable 'AutoSelfCheckAllowed' >2) Enable 'SelfCheckinModule' system preference >3) Visit /cgi-bin/koha/sci/sci-main.pl and notice a login page loads >4) Apply patch and restart services >5) Repeat step 3 and notice a login page does not load this time >6) Enter a barcode, check an item in > >Sponsored-by: Catalyst IT >--- > C4/Auth.pm | 21 ++++++++++++--------- > opac/sci/sci-main.pl | 15 ++++++++++++--- > 2 files changed, 24 insertions(+), 12 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 96d8feb7732..eb53f1d64b1 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -177,6 +177,7 @@ sub get_template_and_user { > > if ( $in->{'template_name'} !~ m/maintenance/ ) { > ( $user, $cookie, $sessionID, $flags ) = checkauth( >+ > $in->{'query'}, > $in->{'authnotrequired'}, > $in->{'flagsrequired'}, >@@ -204,11 +205,11 @@ sub get_template_and_user { > } > > if ( $in->{type} eq 'opac' && $user ) { >- my $is_sco_user; >+ my $is_sc_user; > if ($sessionID){ > my $session = get_session($sessionID); > if ($session){ >- $is_sco_user = $session->param('sco_user'); >+ $is_sc_user = $session->param('sco_user'); > } > } > my $kick_out; >@@ -216,9 +217,9 @@ sub get_template_and_user { > if ( > # If the user logged in is the SCO user and they try to go out of the SCO module, > # log the user out removing the CGISESSID cookie >- $in->{template_name} !~ m|sco/| && $in->{template_name} !~ m|errors/errorpage.tt| >+ $in->{template_name} !~ m|sco/| && $in->{template_name} !~ m|sci/| && $in->{template_name} !~ m|errors/errorpage.tt| > && ( >- $is_sco_user || >+ $is_sc_user || > ( > C4::Context->preference('AutoSelfCheckID') > && $user eq C4::Context->preference('AutoSelfCheckID') >@@ -1140,6 +1141,8 @@ sub checkauth { > ( > ( $type eq 'opac' ) > && C4::Context->preference('OPACShibOnly') >+ && !$query->param('sco_user_login') >+ && !$query->param('sci_user_login') > ) > || ( ( $type ne 'opac' ) > && C4::Context->preference('staffShibOnly') ) >@@ -1242,11 +1245,12 @@ sub checkauth { > } > } > >- my $is_sco_user = 0; >- if ( $query->param('sco_user_login') && ( $query->param('sco_user_login') eq '1' ) ){ >- $is_sco_user = 1; >+ my $is_sc_user = 0; >+ if ( $query->param('sco_user_login') && ( $query->param('sco_user_login') eq '1' ) || ($query->param('sci_user_login') && ($query->param('sci_user_login') eq '1')) ){ >+ $is_sc_user = 1; > } > >+ > $session->param( 'number', $borrowernumber ); > $session->param( 'id', $userid ); > $session->param( 'cardnumber', $cardnumber ); >@@ -1264,7 +1268,7 @@ sub checkauth { > $session->param( 'shibboleth', $shibSuccess ); > $session->param( 'register_id', $register_id ); > $session->param( 'register_name', $register_name ); >- $session->param( 'sco_user', $is_sco_user ); >+ $session->param( 'sco_user', $is_sc_user ); > } > $session->param('cas_ticket', $cas_ticket) if $cas_ticket; > C4::Context->set_userenv( >@@ -1346,7 +1350,6 @@ sub checkauth { > print $query->redirect(-uri => $uri->as_string, -cookie => $cookie, -status=>'303 See other'); > exit; > } >- > return ( $userid, $cookie, $sessionID, $flags ); > } > >diff --git a/opac/sci/sci-main.pl b/opac/sci/sci-main.pl >index 2171fa42c51..5ee13941eb2 100755 >--- a/opac/sci/sci-main.pl >+++ b/opac/sci/sci-main.pl >@@ -29,15 +29,24 @@ use Try::Tiny qw( catch try ); > > my $cgi = CGI->new; > >+if (C4::Context->preference('AutoSelfCheckAllowed')) >+{ >+ my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID'); >+ my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass'); >+ $cgi->param(-name=>'userid',-values=>[$AutoSelfCheckID]); >+ $cgi->param(-name=>'password',-values=>[$AutoSelfCheckPass]); >+ $cgi->param(-name=>'koha_login_context',-values=>['sco']); >+ } >+ >+# Let Auth know this is a SCI context >+$cgi->param( -name => 'sci_user_login', -values => [1] ); >+ > # 404 if feature is disabled > unless ( C4::Context->preference('SelfCheckInModule') ) { > print $cgi->redirect("/cgi-bin/koha/errors/404.pl"); > exit; > } > >-# Let Auth know this is a SCI context >-$cgi->param( -name => 'sci_user_login', -values => [1] ); >- > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { > template_name => "sci/sci-main.tt", >-- >2.11.0
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 30590
:
134801
|
134909
| 134910