https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33711

--- Comment #12 from David Nind <[email protected]> ---
Created attachment 212436
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212436&action=edit
Bug 33711: (follow-up) Do not find patrons the user cannot see

GET /checkouts/availability and POST /checkouts looked the patron up
with Koha::Patrons->find, so a staff user could check the availability
for, and check out to, a patron they are not allowed to see (library
groups 'Hide patron info', IndependentBranches). circ/circulation.pl
refuses that.

This patch makes the patron the pivot: it is looked up through
Koha::Patrons->search_limited, like GET /patrons/{patron_id} does, and
patrons the user cannot see return 404.

The existing get_availability() and add() tests are about circulation,
not patron visibility: their staff users are given the
view_borrower_infos_from_any_libraries permission, and the
IndependentBranches tests use a patron from the librarian's library. A
new subtest covers the visibility rules.

Test plan:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ restart_all
  k$ prove t/db_dependent/api/v1/checkouts.t \
           xt/api.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Assisted-by: Opus 5.5 (Anthropic)
Signed-off-by: David Nind <[email protected]>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to