mirror of https://github.com/MISP/MISP
chg: [attribute] Added tag handling when saving attributes and objects
parent
5b4cef3e6c
commit
6c1bbf0fde
|
@ -3732,7 +3732,12 @@ class Attribute extends AppModel
|
|||
}
|
||||
unset($attribute['Attachment']);
|
||||
$this->create();
|
||||
$saveResult = $saveResult && $this->save($attribute);
|
||||
$currentSave = $this->save($attribute);
|
||||
$saveResult = $saveResult && $currentSave;
|
||||
if ($currentSave) {
|
||||
$attribute['id'] = $this->id;
|
||||
$this->Attribute->AttributeTag->handleAttributeTags($attribute, $attribute['event_id']);
|
||||
}
|
||||
}
|
||||
return $saveResult;
|
||||
}
|
||||
|
|
|
@ -850,6 +850,9 @@ class MispObject extends AppModel
|
|||
$newAttribute['object_id'] = $object['Object']['id'];
|
||||
$newAttribute['timestamp'] = $date->getTimestamp();
|
||||
$result = $this->Event->Attribute->save(array('Attribute' => $newAttribute), array('fieldList' => $this->Attribute->editableFieds));
|
||||
if ($result) {
|
||||
$this->Event->Attribute->AttributeTag->handleAttributeTags($newAttribute, $newAttribute['event_id']);
|
||||
}
|
||||
}
|
||||
unset($object['Attribute'][$origKey]);
|
||||
continue 2;
|
||||
|
@ -878,7 +881,11 @@ class MispObject extends AppModel
|
|||
$newAttribute['distribution'] = 5;
|
||||
}
|
||||
}
|
||||
$this->Event->Attribute->save($newAttribute);
|
||||
$saveResult = $this->Event->Attribute->save($newAttribute);
|
||||
if ($saveResult) {
|
||||
$newAttribute['id'] = $this->Event->Attribute->id;
|
||||
$this->Event->Attribute->AttributeTag->handleAttributeTags($newAttribute, $newAttribute['event_id']);
|
||||
}
|
||||
$attributeArrays['add'][] = $newAttribute;
|
||||
unset($objectToSave['Attribute'][$newKey]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue