Bugzilla – Attachment 169412 Details for
Bug 37378
Patron searches can fail when library groups are set to 'Limit patron data access by group'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37378: libraries_where_can_see_things should always return an array
Bug-37378-librarieswherecanseethings-should-always.patch (text/plain), 2.47 KB, created by
Nick Clemens (kidclamp)
on 2024-07-23 12:27:47 UTC
(
hide
)
Description:
Bug 37378: libraries_where_can_see_things should always return an array
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-07-23 12:27:47 UTC
Size:
2.47 KB
patch
obsolete
>From 5f66fd01d43712039b1d699cddea78401dfd897a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 23 Jul 2024 12:14:44 +0000 >Subject: [PATCH] Bug 37378: libraries_where_can_see_things should always > return an array > >The subroutine libraries_where_can_see_things stores the list of libraries that things >can be viewed from in an internal variable, so we can return this directly if we have already calculated. > >When returning if not cached, we dereference the list and return an array. If cached, we are returning >an arrayref. This patch simply ensures we dereference the array even if already cached. > >Before this patch, we were fetching the patrons, then redacting all info as their branches didn't match against >an arrayref, rather than checking against each branch we are allowed to view. > >To test: >1. Setup a library group and check the "Limit patron data access by group ." option. >2. Add some libraries to the group. ( IN k-t-d I added CPL and MPL ) >3. Create a staff account who has staff access permissions and all of the borrower permissions except "view_borrower_infos_from_any_libraries" >4. Set the home library of that staff member to one of the branches in step 2. ( In my test I choose MPL ) >5. Log in as that patron and attempt a patron search that would include users from either library in step 2. >6. See the error: > >Something went wrong when loading the table. >500: Internal Server Error. >Expected boolean - got null. >Expected boolean - got null. >Expected string - got null. >Expected string - got null. >Expected string - got null. >Expected integer - got null. >Expected integer - got null. >Expected integer - got null. >Expected boolean - got null. >Expected boolean - got null. >Expected string - got null. > >7. Apply patch, restart all >8. Search again, you can see the expected patrons >--- > Koha/Patron.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 2034a6d1378..04c8ef68142 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1947,7 +1947,7 @@ sub libraries_where_can_see_things { > my $subpermission = $params->{subpermission}; > my $group_feature = $params->{group_feature}; > >- return $self->{"_restricted_branchcodes:$permission:$subpermission:$group_feature"} >+ return @{ $self->{"_restricted_branchcodes:$permission:$subpermission:$group_feature"} } > if exists( $self->{"_restricted_branchcodes:$permission:$subpermission:$group_feature"} ); > > my $userenv = C4::Context->userenv; >-- >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 37378
:
169411
|
169412
|
169413
|
169430
|
169431
|
169432
|
169711
|
169713
|
169714