fix: servers cannot be edited via API when MISP.host_org_id setting is empty.

pull/7405/head
Luciano Righetti 2021-05-11 15:03:14 +02:00
parent 25cb3942d7
commit 8507d324eb
1 changed files with 3 additions and 3 deletions

View File

@ -455,14 +455,14 @@ class ServersController extends AppController
$this->redirect(array('controller' => 'servers', 'action' => 'index'));
}
if ($this->request->is('post') || $this->request->is('put')) {
if (empty(Configure::read('MISP.host_org_id'))) {
$this->request->data['Server']['internal'] = 0;
}
if ($this->_isRest()) {
if (!isset($this->request->data['Server'])) {
$this->request->data = array('Server' => $this->request->data);
}
}
if (empty(Configure::read('MISP.host_org_id'))) {
$this->request->data['Server']['internal'] = 0;
}
if (isset($this->request->data['Server']['json'])) {
$json = json_decode($this->request->data['Server']['json'], true);
} else {