fix: [correlation] fixed missing passed sharing group ID array

pull/8552/head
iglocska 2022-08-01 00:43:36 +02:00
parent ed5f3ea79c
commit be67304988
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 3 additions and 3 deletions

View File

@ -2204,7 +2204,7 @@ class Attribute extends AppModel
$this->attachTagsToAttributes($results, $options);
$proposals_block_attributes = Configure::read('MISP.proposals_block_attributes');
$sgids = $this->SharingGroup->authorizedIds($user);
foreach ($results as &$attribute) {
if (!empty($options['includeContext'])) {
$attribute['Event'] = $eventsById[$attribute['Attribute']['event_id']];
@ -2216,7 +2216,7 @@ class Attribute extends AppModel
}
if (!empty($options['includeCorrelations'])) {
$attributeFields = array('id', 'event_id', 'object_id', 'object_relation', 'category', 'type', 'value', 'uuid', 'timestamp', 'distribution', 'sharing_group_id', 'to_ids', 'comment');
$attribute['Attribute']['RelatedAttribute'] = $this->Correlation->getRelatedAttributes($user, $attribute['Attribute'], $attributeFields, true);
$attribute['Attribute']['RelatedAttribute'] = $this->Correlation->getRelatedAttributes($user, $sgids, $attribute['Attribute'], $attributeFields, true);
}
if ($options['enforceWarninglist'] && !$this->Warninglist->filterWarninglistAttribute($attribute['Attribute'])) {
continue;

View File

@ -824,7 +824,7 @@ class Correlation extends AppModel
* @param bool $includeEventData Flag to include the event data in the response
* @return array
*/
public function getRelatedAttributes($user, $sgids, $attribute, $fields=[], $includeEventData = false): array
public function getRelatedAttributes($user, $sgids, $attribute, $fields=[], $includeEventData = false)
{
if (in_array($attribute['type'], Attribute::NON_CORRELATING_TYPES)) {
return null;