From fe7f65d948bda76a5b6bdd792a0e2bea9179aedf Mon Sep 17 00:00:00 2001 From: Flaviu Mates Date: Fri, 11 Jun 2021 15:22:28 +0300 Subject: [PATCH] TT#99700 Fix subscribers PATCH in case of admin without show_passwords * restore password field in prepare_resource after it was deleted in resource_from_item for admins without show_passwords flag * the password is restored only in case it's missing from resource and it's present in DB Change-Id: I390fb8fb94f4546734cb899c741dc90e439df068 --- lib/NGCP/Panel/Utils/Subscriber.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/NGCP/Panel/Utils/Subscriber.pm b/lib/NGCP/Panel/Utils/Subscriber.pm index 212f1f5369..fdfd7e3031 100644 --- a/lib/NGCP/Panel/Utils/Subscriber.pm +++ b/lib/NGCP/Panel/Utils/Subscriber.pm @@ -337,7 +337,13 @@ sub prepare_resource { and $resource->{webpassword} eq $item->provisioning_voip_subscriber->webpassword) { $webpassword = delete $resource->{webpassword}; } - + + #password is mandatory field, so it cannot be absent from resource, the only reason for that being it was + #deleted in resource_from_item for admins without show_passwords flag; in this case, we are restoring it here + if (not length($resource->{password}) and $item and length($item->provisioning_voip_subscriber->password)) { + $resource->{password} = $item->provisioning_voip_subscriber->password; + } + return unless &$validate_code($resource); $resource->{webpassword} = $webpassword if ($webpassword);