From 5e5b2ad76eba2efddadd85e34677619a38db1674 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 10 Apr 2017 17:34:34 -0300 Subject: [PATCH] Bug 18403: REST API - patrons endpoint There is something wrond here, the userenv is no set and so we cannot user search_limited. Should we set the userenv or filter on the libraries using libraries_where_can_see_patrons? WAITING FOR FEEDBACK HERE. --- Koha/REST/V1.pm | 2 +- Koha/REST/V1/Patron.pm | 3 ++- api/v1/swagger/paths/holds.json | 2 +- api/v1/swagger/paths/patrons.json | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm index e307552..14fb8b8 100644 --- a/Koha/REST/V1.pm +++ b/Koha/REST/V1.pm @@ -157,7 +157,7 @@ achieved by defining the operation as follows: "x-koha-authorization": { "allow-owner": true, "permissions": { - "borrowers": "1" + "borrowers": "edit_borrowers" } } } diff --git a/Koha/REST/V1/Patron.pm b/Koha/REST/V1/Patron.pm index 477980e..3b30db3 100644 --- a/Koha/REST/V1/Patron.pm +++ b/Koha/REST/V1/Patron.pm @@ -26,7 +26,8 @@ sub list { my $user = $c->stash('koha.user'); - my $patrons = Koha::Patrons->search; + # FIXME The limited does not work here, the userenv is not set + my $patrons = Koha::Patrons->search_limited; $c->$cb($patrons, 200); } diff --git a/api/v1/swagger/paths/holds.json b/api/v1/swagger/paths/holds.json index 7d67975..b92d86a 100644 --- a/api/v1/swagger/paths/holds.json +++ b/api/v1/swagger/paths/holds.json @@ -129,7 +129,7 @@ "allow-owner": true, "allow-guarantor": true, "permissions": { - "borrowers": "1" + "borrowers": "edit_borrowers" } } }, diff --git a/api/v1/swagger/paths/patrons.json b/api/v1/swagger/paths/patrons.json index 67632e1..aaa2b31 100644 --- a/api/v1/swagger/paths/patrons.json +++ b/api/v1/swagger/paths/patrons.json @@ -25,7 +25,7 @@ }, "x-koha-authorization": { "permissions": { - "borrowers": "1" + "borrowers": "edit_borrowers" } } } @@ -65,7 +65,7 @@ "allow-owner": true, "allow-guarantor": true, "permissions": { - "borrowers": "1" + "borrowers": "edit_borrowers" } } } -- 2.9.3