From e94ee4550982c9f54d0985870ab3decd93c11598 Mon Sep 17 00:00:00 2001 From: Jiri Kozlovsky Date: Sat, 14 Jan 2017 22:24:42 +0000 Subject: [PATCH] QA followup test plan unchanged https://bugs.koha-community.org/show_bug.cgi?id=17314 --- Koha/REST/V1/Suggestions.pm | 6 ++++-- api/v1/swagger/definitions/suggestion.json | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Koha/REST/V1/Suggestions.pm b/Koha/REST/V1/Suggestions.pm index 2e0a9ee..bc5df3c 100644 --- a/Koha/REST/V1/Suggestions.pm +++ b/Koha/REST/V1/Suggestions.pm @@ -29,6 +29,8 @@ use Koha::Suggestions; use Koha::ItemTypes; use Koha::Libraries; +use List::MoreUtils qw/any/; + use Try::Tiny; sub list { @@ -175,8 +177,8 @@ sub _validate_body { } foreach my $param ( keys %{ $body } ) { - unless (/^$param$/ ~~ @allowed_fields) { - # Ouch ! Some mandatory field is missing! + unless (any { /^$param$/ } @allowed_fields) { + # Ouch ! User trying to edit field he has no rights to edit! my $verb = $updating ? 'updated ' : 'specified '; return $c->$cb({error => 'You ' . $verb . $param . ', but allowed fields are only ' . join(', ', @allowed_fields)}, 403); diff --git a/api/v1/swagger/definitions/suggestion.json b/api/v1/swagger/definitions/suggestion.json index 12ff222..844354b 100644 --- a/api/v1/swagger/definitions/suggestion.json +++ b/api/v1/swagger/definitions/suggestion.json @@ -10,7 +10,7 @@ "description": "borrowernumber for the person making the suggestion, foreign key linking to the borrowers table" }, "suggesteddate": { - "type": "string", + "type": ["string", "null"], "description": "the suggestion was submitted" }, "managedby": { @@ -70,7 +70,7 @@ "description": "volume description" }, "publicationyear": { - "type": "string", + "type": ["string", "null"], "description": "year of publication" }, "place": { -- 2.1.4