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

--- Comment #41 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 210934
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210934&action=edit
Bug 43030: (QA follow-up) Fix test plans, the 403 body, and do not allow owner
edits of patrons

* t/db_dependent/Koha/REST/Plugin/Objects.t and t/db_dependent/api/v1/patrons.t
  planned fewer tests than they run (bad plan): Objects.t 21 -> 22, and
  patrons.t list() 4 -> 5 and get() 5 -> 6.
* The 403 for an authorization failure that is not about a permission, such
  as not owning the resource, returned "required_permissions": null. The
  property is now left out when there is no permission to report.
* PUT /patrons/{patron_id} is no longer admitted through allow-owner. Any
  authenticated patron, staff or not, passes allow-owner, and nothing limits
  the fields they could then write: a patron could change their own
  category, library, expiry date and so on. Reading one's own record
  (GET /patrons and GET /patrons/{patron_id}) is unchanged. Editing one's own
  record can be added later, with an explicit list of fields allowed. The
  controller is back to the original lookup, as it no longer needs the
  ownership check.

The self-access tests now also cover reading the record of another patron
of the same library (403) and that a patron cannot edit their own record.

To test:
1. Apply the patches
2. yarn build; restart_all
3. prove t/db_dependent/Koha/REST/Plugin/Objects.t \
         t/db_dependent/api/v1/patrons.t xt/api.t
=> SUCCESS: Tests pass!
4. As a staff user without any borrowers permission, GET
   /api/v1/patrons/{patron_id} of another patron of your library
=> 403 {"error":"Authorization failure. You do not own this resource."}
   without required_permissions
5. GET /api/v1/patrons/{patron_id} of your own patron_id
=> 200
6. PUT /api/v1/patrons/{patron_id} of your own patron_id
=> 403 with required_permissions, nothing changed
7. Sign off :-D

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
You are receiving this mail because:
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