From 706b472465b2c0b057223925d129675fcfe27b14 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Tue, 3 Oct 2023 11:48:36 +0200 Subject: [PATCH] MT#58430 fix allowed_ngcp_types in API GET * allowed_ngcp_types check is now correct in the Controller:API::Root::GET * also fix allowed roles check Change-Id: I2446d7377d2a1ef152560bfb2799bb9debd0f34b --- lib/NGCP/Panel/Controller/API/Root.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/Panel/Controller/API/Root.pm b/lib/NGCP/Panel/Controller/API/Root.pm index c6c6ddf9fb..89a5770a58 100644 --- a/lib/NGCP/Panel/Controller/API/Root.pm +++ b/lib/NGCP/Panel/Controller/API/Root.pm @@ -13,6 +13,7 @@ use JSON qw(to_json encode_json); use YAML::XS qw/Dump/; use Safe::Isa qw($_isa); use NGCP::Panel::Utils::API; +use List::Util qw(none); use parent qw/Catalyst::Controller NGCP::Panel::Role::API/; use NGCP::Panel::Utils::Journal qw(); @@ -96,14 +97,14 @@ sub GET : Allow { my $role = $full_mod->config->{action}->{OPTIONS}->{AllowedRole}; if($role && ref $role eq "ARRAY") { - next unless grep { $user_roles{$_}; } @{ $role }; + next if none { $user_roles{$_} } @{ $role }; } elsif ($role) { next unless $user_roles{$role}; } my $allowed_ngcp_types = $full_mod->config->{allowed_ngcp_types} // []; if (@{$allowed_ngcp_types}) { - next unless grep { /^\Q$c->config->{general}{ngcp_type}\E$/ } + next if none { $_ eq $c->config->{general}{ngcp_type} } @{$allowed_ngcp_types}; }