mirror of https://github.com/MISP/MISP
chg: Server pull/push endpoints allow the passing of the parameters as a POSTed JSON in addition to URL parameters, partially fixes #4889
parent
e560c0c50d
commit
a89b32d0c4
|
@ -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'));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue