diff --git a/app/Controller/Component/RestSearchComponent.php b/app/Controller/Component/RestSearchComponent.php index bbc2bd584..420fdd82c 100644 --- a/app/Controller/Component/RestSearchComponent.php +++ b/app/Controller/Component/RestSearchComponent.php @@ -119,7 +119,8 @@ class RestSearchComponent extends Component 'noEventReports', 'noShadowAttributes', 'order', - 'protected' + 'protected', + 'includeGranularCorrelations' ], 'Object' => [ 'returnFormat', diff --git a/app/Lib/Tools/JSONConverterTool.php b/app/Lib/Tools/JSONConverterTool.php index fe4b24279..48a93eb0e 100644 --- a/app/Lib/Tools/JSONConverterTool.php +++ b/app/Lib/Tools/JSONConverterTool.php @@ -79,11 +79,31 @@ class JSONConverterTool } if (isset($event['Event']['Attribute'])) { $event['Event']['Attribute'] = self::__cleanAttributes($event['Event']['Attribute'], $tempSightings); + if (!empty($event['Event']['RelatedAttribute'])) { + foreach ($event['Event']['Attribute'] as $k => $attribute) { + if (isset($event['Event']['RelatedAttribute'][$attribute['id']])) { + foreach($event['Event']['RelatedAttribute'][$attribute['id']] as $correlation) { + $event['Event']['Attribute'][$k]['RelatedAttribute'][] = [ + 'id' => $correlation['attribute_id'], + 'value' => $correlation['value'], + 'org_id' => $correlation['org_id'], + 'info' => $correlation['info'], + 'event_id' => $correlation['id'] + ]; + } + } + } + } } if (isset($event['Event']['Object'])) { $event['Event']['Object'] = self::__cleanObjects($event['Event']['Object'], $tempSightings); } unset($tempSightings); + if (!empty($event['Event']['RelatedAttribute'])) { + foreach ($event['Event']['RelatedAttribute'] as $attribute_id => $relatedAttribute) { + + } + } unset($event['Event']['RelatedAttribute']); // Remove information about user_id from JSON export diff --git a/app/Model/Event.php b/app/Model/Event.php index e248465bb..fe4347265 100755 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -178,6 +178,7 @@ class Event extends AppModel 'includeFeedCorrelations', 'includeServerCorrelations', 'includeWarninglistHits', + 'includeGranularCorrelations', 'noEventReports', // do not include event report in event data 'noShadowAttributes', // do not fetch proposals, 'limit',