mirror of https://github.com/MISP/MISP
Merge pull request #7830 from JakubOnderka/audit-log-undefined-index
fix: [log] Undefined index localpull/7831/head
commit
d74343b7b6
|
@ -3616,7 +3616,11 @@ class Attribute extends AppModel
|
|||
$at['event_id'] = $eventId;
|
||||
$toSave[] = $at;
|
||||
}
|
||||
$this->AttributeTag->saveMany($toSave, ['validate' => true]);
|
||||
if (!$this->AttributeTag->saveMany($toSave, ['validate' => true])) {
|
||||
$this->log("Could not save tags when capturing attribute with ID {$this->id}.", LOG_WARNING);
|
||||
} else if (!empty($this->AttributeTag->validationErrors)) {
|
||||
$this->log("Could not save some tags when capturing attribute with ID {$this->id}: " . json_encode($this->AttributeTag->validationErrors), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
if (isset($attribute['Tag'])) {
|
||||
if (!empty($attribute['Tag']['name'])) {
|
||||
|
|
|
@ -150,12 +150,13 @@ class AuditLogBehavior extends ModelBehavior
|
|||
$modelName = $model->name === 'MispObject' ? 'Object' : $model->name;
|
||||
|
||||
if ($modelName === 'AttributeTag' || $modelName === 'EventTag') {
|
||||
$action = $model->data[$model->alias]['local'] ? AuditLog::ACTION_TAG_LOCAL : AuditLog::ACTION_TAG;
|
||||
$isLocal = isset($model->data[$model->alias]['local']) ? $model->data[$model->alias]['local'] : false;
|
||||
$action = $isLocal ? AuditLog::ACTION_TAG_LOCAL : AuditLog::ACTION_TAG;
|
||||
$tagInfo = $this->getTagInfo($model, $model->data[$model->alias]['tag_id']);
|
||||
if ($tagInfo) {
|
||||
$modelTitle = $tagInfo['tag_name'];
|
||||
if ($tagInfo['is_galaxy']) {
|
||||
$action = $model->data[$model->alias]['local'] ? AuditLog::ACTION_GALAXY_LOCAL : AuditLog::ACTION_GALAXY;
|
||||
$action = $isLocal ? AuditLog::ACTION_GALAXY_LOCAL : AuditLog::ACTION_GALAXY;
|
||||
if ($tagInfo['galaxy_cluster_name']) {
|
||||
$modelTitle = $tagInfo['galaxy_cluster_name'];
|
||||
}
|
||||
|
@ -225,12 +226,13 @@ class AuditLogBehavior extends ModelBehavior
|
|||
$id = $model->id;
|
||||
|
||||
if ($modelName === 'AttributeTag' || $modelName === 'EventTag') {
|
||||
$action = $model->data[$model->alias]['local'] ? AuditLog::ACTION_REMOVE_TAG_LOCAL : AuditLog::ACTION_REMOVE_TAG;
|
||||
$isLocal = isset($model->data[$model->alias]['local']) ? $model->data[$model->alias]['local'] : false;
|
||||
$action = $isLocal ? AuditLog::ACTION_REMOVE_TAG_LOCAL : AuditLog::ACTION_REMOVE_TAG;
|
||||
$tagInfo = $this->getTagInfo($model, $model->data[$model->alias]['tag_id']);
|
||||
if ($tagInfo) {
|
||||
$modelTitle = $tagInfo['tag_name'];
|
||||
if ($tagInfo['is_galaxy']) {
|
||||
$action = $model->data[$model->alias]['local'] ? AuditLog::ACTION_REMOVE_GALAXY_LOCAL : AuditLog::ACTION_REMOVE_GALAXY;
|
||||
$action = $isLocal ? AuditLog::ACTION_REMOVE_GALAXY_LOCAL : AuditLog::ACTION_REMOVE_GALAXY;
|
||||
if ($tagInfo['galaxy_cluster_name']) {
|
||||
$modelTitle = $tagInfo['galaxy_cluster_name'];
|
||||
}
|
||||
|
|
|
@ -3837,7 +3837,11 @@ class Event extends AppModel
|
|||
$et['event_id'] = $this->id;
|
||||
$toSave[] = $et;
|
||||
}
|
||||
$this->EventTag->saveMany($toSave, ['validate' => true]);
|
||||
if (!$this->EventTag->saveMany($toSave, ['validate' => true])) {
|
||||
$this->log("Could not save tags when capturing event with ID {$this->id}.", LOG_WARNING);
|
||||
} else if (!empty($this->EventTag->validationErrors)) {
|
||||
$this->log("Could not save some tags when capturing event with ID {$this->id}: " . json_encode($this->EventTag->validationErrors), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
$parentEvent = $this->find('first', array(
|
||||
'conditions' => array('Event.id' => $this->id),
|
||||
|
|
Loading…
Reference in New Issue