mirror of https://github.com/MISP/MISP
fix: [API] Correctly embed attributes and the event metadata in the object via /objects/view/[ID]
parent
7b9c1c9f24
commit
31ac700a15
|
@ -612,7 +612,14 @@ class ObjectsController extends AppController
|
||||||
if ($this->_isRest()) {
|
if ($this->_isRest()) {
|
||||||
$objects = $this->MispObject->fetchObjects($this->Auth->user(), array('conditions' => array('Object.id' => $id)));
|
$objects = $this->MispObject->fetchObjects($this->Auth->user(), array('conditions' => array('Object.id' => $id)));
|
||||||
if (!empty($objects)) {
|
if (!empty($objects)) {
|
||||||
return $this->RestResponse->viewData($objects[0], $this->response->type());
|
$object = $objects[0];
|
||||||
|
if (!empty($object['Event'])) {
|
||||||
|
$object['Object']['Event'] = $object['Event'];
|
||||||
|
}
|
||||||
|
if (!empty($object['Attribute'])) {
|
||||||
|
$object['Object']['Attribute'] = $object['Attribute'];
|
||||||
|
}
|
||||||
|
return $this->RestResponse->viewData(array('Object' => $object['Object']), $this->response->type());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue