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

Martin Renvoize (ashimema) <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Failed QA                   |Signed Off

--- Comment #42 from Martin Renvoize (ashimema) 
<[email protected]> ---
Thanks Arthur, thanks David.

Arthur, the QA findings:
* The bad plans are fixed (Objects.t 22, patrons.t list() 5 and get() 6).
* The 403 for a resource that is not the caller's own no longer returns
"required_permissions": null; the property is left out when there is no
permission to report.
* yarn api:bundle is part of yarn build, which is the documented step after
changing the swagger files, so nothing to change there.

Your question about a plain borrower: yes. Any authenticated patron, staff or
not, passes allow-owner. Looking at that again, it is a problem for PUT
/patrons/{patron_id}: nothing limits the fields they could write, so a patron
could change their own category, library or expiry date. So PUT is no longer
admitted through allow-owner. Reading one's own record (GET /patrons and GET
/patrons/{patron_id}) is unchanged, and editing one's own record can come later
with an explicit list of allowed fields. The checkouts and holds routes under
/patrons/{patron_id} are not covered; the series covers /patrons (read only)
and /jobs, and the other routes are follow up work.

The patches you signed off are unchanged: all of Arthur's sign-offs are kept on
the first 12, and the fixes are in one new (QA follow-up) patch on top. The
tests of the self-access routes now also cover reading the record of another
patron (403) and that a patron cannot edit their own record.

David, on "owner": you are right that it assumes one owner. Both
implementations here are one-to-one (a patron record is owned by the patron it
is, a background job by the patron who enqueued it), but guarantors and
guarantees, a suggestion that belongs to both a patron and a librarian, or a
list shared with other patrons are many-to-many. Since each class implements
its own is_owned_by, a class can return true for several relationships, and
owned_by can return the records of all of them. So the approach allows it, and
I would not block this patchset on it.

What I would like to discuss, for both of you, is how this relates to
is_accessible. They are different today: is_accessible is used by to_api to
redact fields, defaults to allow, and Koha::Patron implements it as library
visibility (can_see_patron_infos), while is_owned_by admits a request or scopes
a list, defaults to deny, and is a one column match. What I want in the end is
a clear contract for developers about what their authorization methods should
implement. Should this rather extend is_accessible, with a documented contract
for who may see an object, who may read it and who may change it (and which
fields)? Or stay separate and be documented clearly in Koha::Object? Either can
be done as a follow-up, and the many-to-many cases fit either one.

All patches are re-attached, rebased on current main. Setting back to Signed
Off for another look.

-- 
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