Bugzilla – Attachment 167035 Details for
Bug 36665
Auto location and IP recognition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36665: (follow-up) Allow choosing a branch with no IP when using AutoLocation
Bug-36665-follow-up-Allow-choosing-a-branch-with-n.patch (text/plain), 2.56 KB, created by
Nick Clemens (kidclamp)
on 2024-05-22 13:09:05 UTC
(
hide
)
Description:
Bug 36665: (follow-up) Allow choosing a branch with no IP when using AutoLocation
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-05-22 13:09:05 UTC
Size:
2.56 KB
patch
obsolete
>From 8750395075a3992f49fdce4de63a664bd299925a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 22 May 2024 13:08:43 +0000 >Subject: [PATCH] Bug 36665: (follow-up) Allow choosing a branch with no IP > when using AutoLocation > >--- > C4/Auth.pm | 8 +++++++- > t/db_dependent/Auth.t | 9 ++++++++- > 2 files changed, 15 insertions(+), 2 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index b313687b2f0..7a404bb4481 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -1235,11 +1235,17 @@ sub checkauth { > } > > if ( >+ # If StaffLoginBranchBasedOnIP is enabled we will try to find a branch >+ # matching your ip, regarless of the choice you have passed in > ( > !C4::Context->preference('AutoLocation') > && C4::Context->preference('StaffLoginBranchBasedOnIP') > ) >- || ( C4::Context->preference('AutoLocation') && $auth_state ne 'failed' ) >+ # When AutoLocation is enabled we will not choose a branch matching IP >+ # if your selected branch has no IP set >+ || ( C4::Context->preference('AutoLocation') >+ && $auth_state ne 'failed' >+ && $branches->{$branchcode}->{'branchip'} ) > ) > { > foreach my $br ( uniq( $branchcode, keys %$branches ) ) { >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index 71d4a63c26b..8627873e951 100755 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -1344,7 +1344,7 @@ subtest 'StaffLoginBranchBasedOnIP' => sub { > > subtest 'AutoLocation' => sub { > >- plan tests => 7; >+ plan tests => 8; > > $schema->storage->txn_begin; > >@@ -1396,6 +1396,13 @@ subtest 'AutoLocation' => sub { > my $session = C4::Auth::get_session($sessionID); > is( $session->param('branch'), $patron->branchcode ); > >+ my $noip_library = $builder->build_object( { class => 'Koha::Libraries', value => { branchip => '' } } ); >+ $cgi->param('branch', $noip_library->branchcode ); >+ ( $userid, $cookie, $sessionID, $flags, $template ) = >+ C4::Auth::checkauth( $cgi, 0, { catalogue => 1 }, 'intranet' ); >+ $session = C4::Auth::get_session($sessionID); >+ is( $session->param('branch'), $noip_library->branchcode ); >+ > $schema->storage->txn_rollback; > > }; >-- >2.39.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 36665
:
166889
|
166904
|
166941
|
166963
|
166964
|
167035
|
167036
|
167037
|
167038
|
167039
|
167117