Bug 29506 - objects.search should call search_limited if present
Summary: objects.search should call search_limited if present
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Tomás Cohen Arazi
QA Contact:
URL:
Keywords:
Depends on: 29503
Blocks: 29509 29508
  Show dependency treegraph
 
Reported: 2021-11-17 17:29 UTC by Tomás Cohen Arazi
Modified: 2022-02-07 18:53 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.02,21.05.08


Attachments
Bug 29506: Regression tests (3.25 KB, patch)
2021-11-17 18:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29506: Make objects.search call search_limited if present (1.46 KB, patch)
2021-11-17 18:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29506: (follow-up) Adapt GET /patrons (1.08 KB, patch)
2021-11-17 18:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29506: Regression tests (3.31 KB, patch)
2021-11-17 19:40 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29506: Make objects.search call search_limited if present (1.52 KB, patch)
2021-11-17 19:40 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29506: (follow-up) Adapt GET /patrons (1.15 KB, patch)
2021-11-17 19:40 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29506: Regression tests (3.37 KB, patch)
2021-12-17 14:17 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 29506: Make objects.search call search_limited if present (1.58 KB, patch)
2021-12-17 14:17 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 29506: (follow-up) Adapt GET /patrons (1.20 KB, patch)
2021-12-17 14:17 UTC, Nick Clemens
Details | Diff | Splinter Review
[21.05.x] Bug 29506: Regression tests (4.69 KB, patch)
2022-01-11 15:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[21.05.x] Bug 29506: Make objects.search call search_limited if present (1.59 KB, patch)
2022-01-11 15:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[21.05.x] Bug 29506: (follow-up) Adapt GET /patrons (1.21 KB, patch)
2022-01-11 15:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2021-11-17 17:29:04 UTC

    
Comment 1 Tomás Cohen Arazi 2021-11-17 17:29:56 UTC
We should use it internally to avoid any leaks.
Comment 2 Tomás Cohen Arazi 2021-11-17 18:01:28 UTC
Created attachment 127751 [details] [review]
Bug 29506: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Tomás Cohen Arazi 2021-11-17 18:01:34 UTC
Created attachment 127752 [details] [review]
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>
Comment 4 Tomás Cohen Arazi 2021-11-17 18:01:39 UTC
Created attachment 127753 [details] [review]
Bug 29506: (follow-up) Adapt GET /patrons

This patch makes GET /patrons rely on this new behavior from the
objects.search helper.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Martin Renvoize 2021-11-17 19:40:39 UTC
Created attachment 127754 [details] [review]
Bug 29506: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2021-11-17 19:40:42 UTC
Created attachment 127755 [details] [review]
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>
Comment 7 Martin Renvoize 2021-11-17 19:40:45 UTC
Created attachment 127756 [details] [review]
Bug 29506: (follow-up) Adapt GET /patrons

This patch makes GET /patrons rely on this new behavior from the
objects.search helper.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2021-11-17 19:44:25 UTC
Nice future-proofing here.. tests all make sense and pass.. including the /patrons regression test introduced in the prior bug.

Signing off
Comment 9 Nick Clemens 2021-12-17 14:17:40 UTC
Created attachment 128668 [details] [review]
Bug 29506: Regression tests

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>
Comment 10 Nick Clemens 2021-12-17 14:17:43 UTC
Created attachment 128669 [details] [review]
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>
Comment 11 Nick Clemens 2021-12-17 14:17:46 UTC
Created attachment 128670 [details] [review]
Bug 29506: (follow-up) Adapt GET /patrons

This patch makes GET /patrons rely on this new behavior from the
objects.search helper.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. 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>
Comment 12 Fridolin Somers 2022-01-06 00:03:10 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 13 Kyle M Hall 2022-01-07 11:35:35 UTC
Pushed to 21.11.x for 21.11.02
Comment 14 Tomás Cohen Arazi 2022-01-11 15:01:45 UTC
Created attachment 129299 [details] [review]
[21.05.x] Bug 29506: Regression tests

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>
Comment 15 Tomás Cohen Arazi 2022-01-11 15:01:49 UTC
Created attachment 129300 [details] [review]
[21.05.x] 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>
Comment 16 Tomás Cohen Arazi 2022-01-11 15:01:54 UTC
Created attachment 129301 [details] [review]
[21.05.x] Bug 29506: (follow-up) Adapt GET /patrons

This patch makes GET /patrons rely on this new behavior from the
objects.search helper.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. 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>
Comment 17 Andrew Fuerste-Henry 2022-01-11 22:04:39 UTC
Pushed to 21.05.x for 21.05.08
Comment 18 Victor Grousset/tuxayo 2022-02-07 18:53:12 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.