]> git.koha-community.org Git - koha.git/commit
Bug 28759: limit accessibility for "Manage API keys"
authorPetro Vashchuk <stalkernoid@gmail.com>
Tue, 10 Aug 2021 15:08:53 +0000 (18:08 +0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 21 Sep 2021 06:21:00 +0000 (20:21 -1000)
commit1dd5b493ac14df87a04539136ff82a4f959dce67
tree0726644e3742015c365d337fffa8567977680364
parent71b7e12f798a9e937e4cbfa87e9ba28ea6d231ea
Bug 28759: limit accessibility for "Manage API keys"

This patch limits the accessibility for "Manage API keys" section only
to superlibrarians and the owner of that said API key account.

The way it does it is by checking if user is superlibrarian or if
logged-in user is the same as a patron id/borrower number is the same
as logged-in user number both in template and apikeys.pl and making sure
the link is inaccessible or redirects to the 403 page if user tries to
go there directly.

To reproduce:
1) create/pick existing patron, set Staff access, allows viewing
of catalogue in staff interface (catalogue)" and "Add, modify and
iew patron information (borrowers)" permissions on;
2) enable "RESTOAuth2ClientCredentials" in sysprefs;
3) login with that user into staff interface;
4) check any other patron, go to the "More"->"Manage API keys" and
check that you can see, add delete their API keys;
5) apply patch;
6) with that same user try to access "Manage API keys" page again.
Ensure that you can't access that page of other patrons but can
access your own page and manage your own API keys.
7) log in with superlibrarian now and ensure that you can access every
"Manage API keys" page of every patron and apply changes there.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
members/apikeys.pl