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
mr9.5.1
Flaviu Mates 5 years ago
parent 102e494708
commit fe7f65d948

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

Loading…
Cancel
Save