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> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
parent
a856a5b88c
commit
eb358bf48f
|
|
@ -150,6 +150,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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue