fix: [mispObject] fixed disable_correlation saving & display issue

Before this fix, MISP was not saving any modification related to disable_correlation.
Moreover, the value of disable_correlation was always set to the one specified in the object's template
regardless of its actual value.
pull/3905/head
Sami Mokaddem 2018-11-21 15:25:03 +01:00
parent cd066dd072
commit 7f71f2d4f8
1 changed files with 4 additions and 2 deletions

View File

@ -416,6 +416,7 @@ class MispObject extends AppModel
}
}
}
$v['disable_correlation'] = $request_item['disable_correlation'];
$template['ObjectTemplateElement'][] = $v;
} else {
$template['warnings'][] = 'Missing attribute type "' . $v['type'] . '" found. Omitted template element ("' . $template_object_elements[$k]['object_relation'] . '") that would not pass validation due to this.';
@ -498,7 +499,7 @@ class MispObject extends AppModel
$date = new DateTime();
$object['Object']['timestamp'] = $date->getTimestamp();
$this->save($object);
$checkFields = array('category', 'value', 'to_ids', 'distribution', 'sharing_group_id', 'comment');
$checkFields = array('category', 'value', 'to_ids', 'distribution', 'sharing_group_id', 'comment', 'disable_correlation');
foreach ($objectToSave['Attribute'] as $newKey => $newAttribute) {
foreach ($object['Attribute'] as $origKey => $originalAttribute) {
if (!empty($newAttribute['uuid'])) {
@ -526,7 +527,8 @@ class MispObject extends AppModel
'comment',
'timestamp',
'object_id',
'event_id'
'event_id',
'disable_correlation'
));
}
unset($object['Attribute'][$origKey]);