From 0b4eca5f11bc970cb0de90b51d8b4af624b48f71 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 7 Aug 2019 08:53:18 +0000 Subject: [PATCH] Bug 17390: Update for current Koha codebase --- Koha/REST/V1/AuthorisedValue.pm | 48 ----------------------------- api/v1/swagger/paths/authorised_values.json | 26 ++++++++++++++++ 2 files changed, 26 insertions(+), 48 deletions(-) delete mode 100644 Koha/REST/V1/AuthorisedValue.pm diff --git a/Koha/REST/V1/AuthorisedValue.pm b/Koha/REST/V1/AuthorisedValue.pm deleted file mode 100644 index 141b6d5d76..0000000000 --- a/Koha/REST/V1/AuthorisedValue.pm +++ /dev/null @@ -1,48 +0,0 @@ -package Koha::REST::V1::AuthorisedValue; - -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) any later -# version. -# -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with Koha; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -use Modern::Perl; - -use Mojo::Base 'Mojolicious::Controller'; - -use C4::Auth qw( haspermission ); -use Koha::AuthorizedValues; - -BEGIN { - warn "TEST"; -} - -sub list { - my ( $c, $args, $cb ) = @_; - - my $user = $c->stash('koha.user'); - unless ( $user && haspermission( $user->userid, { catalogue => 1 } ) ) { - return $c->$cb( - { - error => "You don't have the required permission" - }, - 403 - ); - } - - my $params = $c->req->params->to_hash; - my $av = Koha::Account::AuthorisedValues->search($params); - - return $c->$cb( $av->unblessed, 200 ); -} - -1; diff --git a/api/v1/swagger/paths/authorised_values.json b/api/v1/swagger/paths/authorised_values.json index 084c58bbb8..4da3de221d 100644 --- a/api/v1/swagger/paths/authorised_values.json +++ b/api/v1/swagger/paths/authorised_values.json @@ -1,11 +1,25 @@ { "/authorised_values": { "get": { + "x-mojo-to": "AuthorisedValues#list", "operationId": "listAuthorisedValues", "tags": ["authorised", "values"], "produces": [ "application/json" ], + "parameters": [{ + "name": "category", + "in": "query", + "description": "Search authorised values by category", + "required": false, + "type": "string" + }, { + "name": "value", + "in": "query", + "description": "Search authorised values by value", + "required": false, + "type": "string" + }], "responses": { "200": { "description": "A list of authorised values", @@ -21,6 +35,18 @@ "schema": { "$ref": "../definitions.json#/error" } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "503": { + "description": "Under maintenance", + "schema": { + "$ref": "../definitions.json#/error" + } } } } -- 2.11.0