Bug 35967 - Add /api/v1/patrons/{patron_id}/recalls endpoint to list a patron's recalls
Summary: Add /api/v1/patrons/{patron_id}/recalls endpoint to list a patron's recalls
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Aleisha Amohia
QA Contact: Tomás Cohen Arazi (tcohen)
URL:
Keywords:
Depends on: 19532
Blocks: 36075
  Show dependency treegraph
 
Reported: 2024-01-31 21:20 UTC by Aleisha Amohia
Modified: 2024-05-28 20:14 UTC (History)
3 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06
Circulation function:


Attachments
Bug 35967: Add REST API endpoint to list patron recalls (11.87 KB, patch)
2024-02-01 01:30 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 35967: Add REST API endpoint to list patron recalls (11.96 KB, patch)
2024-02-08 14:49 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35967: Add REST API endpoint to list patron recalls (11.96 KB, patch)
2024-03-11 13:46 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 35967: (QA follow-up) `status` is not nullable (874 bytes, patch)
2024-03-11 13:47 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 35967: Add more test cases (2.07 KB, patch)
2024-03-11 13:47 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2024-01-31 21:20:52 UTC

    
Comment 1 Aleisha Amohia 2024-02-01 01:30:06 UTC
Created attachment 161708 [details] [review]
Bug 35967: Add REST API endpoint to list patron recalls

This enhancement adds a REST API endpoint to list a patron's recalls:

/api/v1/patrons/{patron_id}/recalls

This depends on the logged in patron having the manage_recalls subpermission.

To test:

1. Log in to the staff interface as your superlibrarian self (Patron A)
2. Go to Koha Administration -> Global system preferences. Enable the UseRecalls system preference
3. Set the relevant recalls circulation and fines rules
4. Search for an item (Item A)
5. Check out Item A to yourself (Patron A)
6. Log in to the OPAC as Patron B, a patron who does not have the manage_recalls permission
7. Search for Item A and request a recall
8. While still logged in to the OPAC as Patron B, hit this URL: https://your-opac-url/api/v1/patrons/patron-b-borrowernumber/recalls (swap out your URL and Patron B's borrowernumber)
9. Confirm you are given an error: "Authorization failure. Missing required permission(s)."
10. Log out of the OPAC and log back in, this time as Patron A
11. Hit the URL again https://your-opac-url/api/v1/patrons/patron-b-borrowernumber/recalls
12. Confirm you are able to view a list of Patron B's recalls
13. Confirm tests pass: t/db_dependent/api/v1/patrons_recalls.t

Sponsored-by: Auckland University of Technology
Comment 2 Pedro Amorim 2024-02-08 14:49:49 UTC
Created attachment 161924 [details] [review]
Bug 35967: Add REST API endpoint to list patron recalls

This enhancement adds a REST API endpoint to list a patron's recalls:

/api/v1/patrons/{patron_id}/recalls

This depends on the logged in patron having the manage_recalls subpermission.

To test:

1. Log in to the staff interface as your superlibrarian self (Patron A)
2. Go to Koha Administration -> Global system preferences. Enable the UseRecalls system preference
3. Set the relevant recalls circulation and fines rules
4. Search for an item (Item A)
5. Check out Item A to yourself (Patron A)
6. Log in to the OPAC as Patron B, a patron who does not have the manage_recalls permission
7. Search for Item A and request a recall
8. While still logged in to the OPAC as Patron B, hit this URL: https://your-opac-url/api/v1/patrons/patron-b-borrowernumber/recalls (swap out your URL and Patron B's borrowernumber)
9. Confirm you are given an error: "Authorization failure. Missing required permission(s)."
10. Log out of the OPAC and log back in, this time as Patron A
11. Hit the URL again https://your-opac-url/api/v1/patrons/patron-b-borrowernumber/recalls
12. Confirm you are able to view a list of Patron B's recalls
13. Confirm tests pass: t/db_dependent/api/v1/patrons_recalls.t

Sponsored-by: Auckland University of Technology

PA amended: QA follow-up: tidy

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 3 Tomás Cohen Arazi (tcohen) 2024-03-11 13:46:59 UTC
Created attachment 163032 [details] [review]
Bug 35967: Add REST API endpoint to list patron recalls

This enhancement adds a REST API endpoint to list a patron's recalls:

/api/v1/patrons/{patron_id}/recalls

This depends on the logged in patron having the manage_recalls subpermission.

To test:

1. Log in to the staff interface as your superlibrarian self (Patron A)
2. Go to Koha Administration -> Global system preferences. Enable the UseRecalls system preference
3. Set the relevant recalls circulation and fines rules
4. Search for an item (Item A)
5. Check out Item A to yourself (Patron A)
6. Log in to the OPAC as Patron B, a patron who does not have the manage_recalls permission
7. Search for Item A and request a recall
8. While still logged in to the OPAC as Patron B, hit this URL: https://your-opac-url/api/v1/patrons/patron-b-borrowernumber/recalls (swap out your URL and Patron B's borrowernumber)
9. Confirm you are given an error: "Authorization failure. Missing required permission(s)."
10. Log out of the OPAC and log back in, this time as Patron A
11. Hit the URL again https://your-opac-url/api/v1/patrons/patron-b-borrowernumber/recalls
12. Confirm you are able to view a list of Patron B's recalls
13. Confirm tests pass: t/db_dependent/api/v1/patrons_recalls.t

Sponsored-by: Auckland University of Technology

PA amended: QA follow-up: tidy

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 4 Tomás Cohen Arazi (tcohen) 2024-03-11 13:47:02 UTC
Created attachment 163033 [details] [review]
Bug 35967: (QA follow-up) `status` is not nullable

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Tomás Cohen Arazi (tcohen) 2024-03-11 13:47:04 UTC
Created attachment 163034 [details] [review]
Bug 35967: Add more test cases

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Katrin Fischer 2024-04-19 17:56:03 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 7 Fridolin Somers 2024-05-23 14:23:02 UTC
Pushed to 23.11.x for 23.11.06
Comment 8 Lucas Gass (lukeg) 2024-05-28 20:14:11 UTC
Enhancement will not be backported to 23.05.x