Bug 35967: Add REST API endpoint to list patron recalls
authorAleisha Amohia <aleishaamohia@hotmail.com>
Thu, 1 Feb 2024 00:43:26 +0000 (00:43 +0000)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Fri, 19 Apr 2024 17:54:43 +0000 (19:54 +0200)
commit9d8254efd39ef73741eeb80088c1c3378528918e
tree3d9029ccf9fde662007d9c6b82ef93c9381156dc
parent6764166b20d75e3527b72101d7b02194dd843938
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>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Koha/REST/V1/Patrons/Recalls.pm [new file with mode: 0644]
api/v1/swagger/definitions/recall.yaml [new file with mode: 0644]
api/v1/swagger/definitions/recalls.yaml [new file with mode: 0644]
api/v1/swagger/paths/patrons_recalls.yaml [new file with mode: 0644]
api/v1/swagger/swagger.yaml
t/db_dependent/api/v1/patrons_recalls.t [new file with mode: 0755]