Bugzilla – Attachment 127752 Details for
Bug 29506
objects.search should call search_limited if present
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29506: Make objects.search call search_limited if present
Bug-29506-Make-objectssearch-call-searchlimited-if.patch (text/plain), 1.46 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-11-17 18:01:34 UTC
(
hide
)
Description:
Bug 29506: Make objects.search call search_limited if present
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-11-17 18:01:34 UTC
Size:
1.46 KB
patch
obsolete
>From 783d8523be487cf74c3a0479cfeb1034636ac962 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 17 Nov 2021 14:30:21 -0300 >Subject: [PATCH] Bug 29506: Make objects.search call search_limited if present > >This patch makes objects.search implicitly update the passed >*$result_set* to use search_limited. This way no object leaks could >happen without noticing. > >To test: >1. Apply the regression tests patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t >=> FAIL: Tests fail because search_limited is not used >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! Results are correctly filtered based on userenv! >5. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/Plugin/Objects.pm | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/Koha/REST/Plugin/Objects.pm b/Koha/REST/Plugin/Objects.pm >index ddf2194530..7b843bafbe 100644 >--- a/Koha/REST/Plugin/Objects.pm >+++ b/Koha/REST/Plugin/Objects.pm >@@ -152,6 +152,11 @@ for API rendering. > > $filtered_params = $c->merge_q_params( $filtered_params, $query_params, $result_set ); > } >+ >+ # If search_limited exists, use it >+ $result_set = $result_set->search_limited, >+ if $result_set->can('search_limited'); >+ > # Perform search > my $objects = $result_set->search( $filtered_params, $attributes ); > my $total = $result_set->search->count; >-- >2.34.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 29506
:
127751
|
127752
|
127753
|
127754
|
127755
|
127756
|
128668
|
128669
|
128670
|
129299
|
129300
|
129301