chg: Server pull/push endpoints allow the passing of the parameters as a POSTed JSON in addition to URL parameters, partially fixes #4889

pull/4939/head
iglocska 2019-07-29 10:14:49 +02:00
parent e560c0c50d
commit a89b32d0c4
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 17 additions and 2 deletions

View File

@ -613,7 +613,13 @@ class ServersController extends AppController
*/
public function pull($id = null, $technique='full')
{
$this->Server->id = $id;
if (!empty($id)) {
$this->Server->id = $id;
} else if (!empty($this->request->data['id'])) {
$this->Server->id = $this->request->data['id'];
} else {
throw new NotFoundException(__('Invalid server'));
}
if (!$this->Server->exists()) {
throw new NotFoundException(__('Invalid server'));
}
@ -682,7 +688,16 @@ class ServersController extends AppController
public function push($id = null, $technique=false)
{
$this->Server->id = $id;
if (!empty($id)) {
$this->Server->id = $id;
} else if (!empty($this->request->data['id'])) {
$this->Server->id = $this->request->data['id'];
} else {
throw new NotFoundException(__('Invalid server'));
}
if (!empty($this->request->data['technique'])) {
$technique = $this->request->data['technique'];
}
if (!$this->Server->exists()) {
throw new NotFoundException(__('Invalid server'));
}