diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index d539666232..ee3fcfcae0 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -375,7 +375,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } //add the dialplan permission - $permission = "dialplan_delete"; + $permission = "dialplan_edit"; $p = new permissions; $p->add($permission, 'temp'); @@ -400,10 +400,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } //add or update the dialplan if the destination number is set else { - //remove empty dialplan details from POST array so doesn't attempt to insert below unset($_POST["dialplan_details"]); - } //get the destination_uuid @@ -411,6 +409,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $_POST["dialplan_uuid"] = $dialplan_response['uuid']; } + //add the dialplan permission + $permission = "dialplan_edit"; + $p = new permissions; + $p->add($permission, 'temp'); + //save the destination $orm = new orm; $orm->name('destinations'); @@ -421,6 +424,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $message = $orm->message; $destination_response = $orm->message; + //remove the temporary permission + $p->delete($permission, 'temp'); + //get the destination_uuid if (strlen($destination_response['uuid']) > 0) { $destination_uuid = $destination_response['uuid'];