mirror of https://github.com/MISP/MISP
fix: Flatten events for the correlation graph
parent
d8a6712832
commit
b658c20b75
|
@ -3877,7 +3877,7 @@ class EventsController extends AppController {
|
|||
}
|
||||
|
||||
private function __buildGraphJson($id, $json = array()) {
|
||||
$event = $this->Event->fetchEvent($this->Auth->user(), array('eventid' => $id));
|
||||
$event = $this->Event->fetchEvent($this->Auth->user(), array('eventid' => $id, 'flatten' => 1));
|
||||
if (empty($event)) return $json;
|
||||
$json = $this->__cleanLinks($json);
|
||||
$old_event = $this->__graphJsonContains('event', $event[0]['Event'], $json);
|
||||
|
|
|
@ -1331,7 +1331,7 @@ class Event extends AppModel {
|
|||
// includeAttachments: true will attach the attachments to the attributes in the data field
|
||||
public function fetchEvent($user, $options = array(), $useCache = false) {
|
||||
if (isset($options['Event.id'])) $options['eventid'] = $options['Event.id'];
|
||||
$possibleOptions = array('eventid', 'idList', 'tags', 'from', 'to', 'last', 'to_ids', 'includeAllTags', 'includeAttachments', 'event_uuid', 'distribution', 'sharing_group_id', 'disableSiteAdmin', 'metadata', 'includeGalaxy', 'enforceWarninglist', 'sgReferenceOnly');
|
||||
$possibleOptions = array('eventid', 'idList', 'tags', 'from', 'to', 'last', 'to_ids', 'includeAllTags', 'includeAttachments', 'event_uuid', 'distribution', 'sharing_group_id', 'disableSiteAdmin', 'metadata', 'includeGalaxy', 'enforceWarninglist', 'sgReferenceOnly', 'flatten');
|
||||
if (!isset($options['excludeGalaxy']) || !$options['excludeGalaxy']) {
|
||||
$this->GalaxyCluster = ClassRegistry::init('GalaxyCluster');
|
||||
}
|
||||
|
@ -1350,10 +1350,10 @@ class Event extends AppModel {
|
|||
$conditionsObjects = array();
|
||||
$conditionsObjectReferences = array();
|
||||
|
||||
if (isset($options['flattenObjects']) && $options['flattenObjects']) {
|
||||
$flattenObjects = true;
|
||||
if (isset($options['flatten']) && $options['flatten']) {
|
||||
$flatten = true;
|
||||
} else {
|
||||
$flattenObjects = false;
|
||||
$flatten = false;
|
||||
}
|
||||
$sgids = $this->cacheSgids($user, $useCache);
|
||||
// restricting to non-private or same org if the user is not a site-admin.
|
||||
|
@ -1507,7 +1507,7 @@ class Event extends AppModel {
|
|||
)
|
||||
)
|
||||
);
|
||||
if ($flattenObjects) {
|
||||
if ($flatten) {
|
||||
unset($params['contain']['Object']);
|
||||
}
|
||||
if ($options['metadata']) {
|
||||
|
@ -1680,7 +1680,7 @@ class Event extends AppModel {
|
|||
}
|
||||
|
||||
}
|
||||
if ($event['Attribute'][$key]['object_id'] != 0) {
|
||||
if (!$flatten && $event['Attribute'][$key]['object_id'] != 0) {
|
||||
if (!empty($event['Object'])) {
|
||||
foreach ($event['Object'] as $objectKey => $objectValue) {
|
||||
if ($event['Attribute'][$key]['object_id'] == $objectValue['id']) {
|
||||
|
|
Loading…
Reference in New Issue