From 6a0b5d7a759d00d931465ba5c2da90b65b506b84 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Wed, 10 Nov 2021 14:34:00 +0100 Subject: [PATCH] TT#149459 expand consider null fields as valid * when field expand is requested and the field has "null" value (profile_id,profile_set_id), the field is considered as correct instead of returning 409 Conflict Change-Id: I2dfa918a0b99bff75429baa3e94a734fcb8c17e2 --- lib/NGCP/Panel/Role/API.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/Panel/Role/API.pm b/lib/NGCP/Panel/Role/API.pm index e0b2ea9112..d46d162810 100644 --- a/lib/NGCP/Panel/Role/API.pm +++ b/lib/NGCP/Panel/Role/API.pm @@ -1332,7 +1332,7 @@ sub expand_field { $subfield = $2; } - return unless $resource->{$field}; + return unless exists $resource->{$field}; $found = 1; my $expand_form = NGCP::Panel::Form::get("NGCP::Panel::Form::Expand", $c); @@ -1354,7 +1354,7 @@ sub expand_field { return unless $expand->{allowed_roles}; return unless any { $c->user->roles eq $_ } @{$expand->{allowed_roles}}; - my $id = $resource->{$field}; + my $id = $resource->{$field} // return $found; # null value but the field exists my $to = $expand->{to} // $field . '_expand'; my $class = $expand->{class} // return; my $form = $class->get_form($c) // return;