From 941c75ebe1f3318a98be945652b07f14e74e59da Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Mon, 8 Apr 2024 13:15:34 +0200 Subject: [PATCH] MT#59078 ?create_primary_acli= query param creating or updating subscriber (-aliases) will modify the allowedcli (acli) preference, if the auto_allow_cli config option is set. the primary number will also be part of the acli list. when specifying ?create_primary_acli=false or ?create_primary_acli=0, the primary alias will no longer be added to acli. Change-Id: I4641e2b973de2afe2e36805140b1546cac2a699a --- lib/NGCP/Panel/Utils/Subscriber.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/Panel/Utils/Subscriber.pm b/lib/NGCP/Panel/Utils/Subscriber.pm index 443645aebb..56dbe5a728 100644 --- a/lib/NGCP/Panel/Utils/Subscriber.pm +++ b/lib/NGCP/Panel/Utils/Subscriber.pm @@ -1313,6 +1313,15 @@ sub update_subscriber_numbers { $acli_pref = NGCP::Panel::Utils::Preferences::get_usr_preference_rs( c => $c, attribute => 'allowed_clis', prov_subscriber => $prov_subs) if($prov_subs && $c->config->{numbermanagement}->{auto_allow_cli}); + + my $create_primary_acli = $c->request->params->{create_primary_acli}; + if (length($create_primary_acli) + and ('false' eq lc($create_primary_acli) + or ('0' eq $create_primary_acli))) { + $create_primary_acli = 0; + } else { + $create_primary_acli = 1; + } if ($same_primary_number) { # skip primary number processing for the same number @@ -1450,7 +1459,7 @@ sub update_subscriber_numbers { if(defined $acli_pref) { $acli_pref->search({ value => $old_cli })->delete if($old_cli); - if(!$acli_pref->find({ value => $cli })) { + if($create_primary_acli && !$acli_pref->find({ value => $cli })) { $acli_pref->create({ value => $cli }); } } @@ -1611,7 +1620,7 @@ sub update_subscriber_numbers { if(defined $acli_pref) { $acli_pref->search({ value => $old_cli })->delete if($old_cli); - if(!$acli_pref->find({ value => $cli })) { + if($create_primary_acli && !$acli_pref->find({ value => $cli })) { $acli_pref->create({ value => $cli }); } }