Bugzilla – Attachment 163308 Details for
Bug 10060
Allow adding a branch parameter to the web-based self check to indicate library its used at
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10060: POC
Bug-10060-POC.patch (text/plain), 1.97 KB, created by
Nick Clemens (kidclamp)
on 2024-03-18 11:38:00 UTC
(
hide
)
Description:
Bug 10060: POC
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-03-18 11:38:00 UTC
Size:
1.97 KB
patch
obsolete
>From 810e766638064e1c1d59ed21fbdc5c97a4ca9e0c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 18 Mar 2024 11:35:48 +0000 >Subject: [PATCH] Bug 10060: POC > >This patch adds a stanza to the SetEnv middleware which checks for a branchcode in the SCO url and captures it. >We then use that branchcode in checkauth to set the userenv to the specified branch (if it is a real branch) > >The regex could probably be improved, and the change needs test coverage, but this might be a valid approach to seeting the branch from the URL. Feedback appreciated >--- > C4/Auth.pm | 4 ++++ > Koha/Middleware/SetEnv.pm | 4 ++++ > 2 files changed, 8 insertions(+) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index a8c21740f00..bcd941dcfee 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -1243,6 +1243,10 @@ 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 $sco_branch = $ENV{'URL_BRANCH'}; >+ if( defined $branches->{$sco_branch} ){ >+ $branchcode = $branches->{$sco_branch}->{'branchcode'}; >+ $branchname = $branches->{$sco_branch}->{'branchname'}; > } > > $session->param( 'number', $borrowernumber ); >diff --git a/Koha/Middleware/SetEnv.pm b/Koha/Middleware/SetEnv.pm >index b0e42d09359..ed66ee7c545 100644 >--- a/Koha/Middleware/SetEnv.pm >+++ b/Koha/Middleware/SetEnv.pm >@@ -76,6 +76,10 @@ my $allowed_setenvs = qr/^( > sub call { > my ( $self, $env ) = @_; > my $req = Plack::Request->new($env); >+ if( $env->{PATH_INFO} =~ /(\/opac\/sco)\/(.*)\/(.*)/ ){ >+ $env->{PATH_INFO} = "$1/$3"; >+ $env->{URL_BRANCH} = $2; >+ } > > # First, we split the result only on unescaped commas. > my @setenv_headers = split /(?<!\\),\s*/, $req->header('X-Koha-SetEnv') || ''; >-- >2.30.2
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 10060
: 163308