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
mr12.0
Kirill Solomko 2 years ago
parent bc62644629
commit 706b472465

@ -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};
}

Loading…
Cancel
Save