Lines 29-34
use Koha::Suggestions;
Link Here
|
29 |
use Koha::ItemTypes; |
29 |
use Koha::ItemTypes; |
30 |
use Koha::Libraries; |
30 |
use Koha::Libraries; |
31 |
|
31 |
|
|
|
32 |
use List::MoreUtils qw/any/; |
33 |
|
32 |
use Try::Tiny; |
34 |
use Try::Tiny; |
33 |
|
35 |
|
34 |
sub list { |
36 |
sub list { |
Lines 175-182
sub _validate_body {
Link Here
|
175 |
} |
177 |
} |
176 |
|
178 |
|
177 |
foreach my $param ( keys %{ $body } ) { |
179 |
foreach my $param ( keys %{ $body } ) { |
178 |
unless (/^$param$/ ~~ @allowed_fields) { |
180 |
unless (any { /^$param$/ } @allowed_fields) { |
179 |
# Ouch ! Some mandatory field is missing! |
181 |
# Ouch ! User trying to edit field he has no rights to edit! |
180 |
my $verb = $updating ? 'updated ' : 'specified '; |
182 |
my $verb = $updating ? 'updated ' : 'specified '; |
181 |
return $c->$cb({error => 'You ' . $verb . $param . ', but allowed fields are only ' . |
183 |
return $c->$cb({error => 'You ' . $verb . $param . ', but allowed fields are only ' . |
182 |
join(', ', @allowed_fields)}, 403); |
184 |
join(', ', @allowed_fields)}, 403); |