mirror of https://github.com/MISP/MISP
chg: Use a more suitable Sighting creation function as recommended, grab the Org ID from the user if present
parent
07b79aee78
commit
626443af47
|
@ -4079,9 +4079,7 @@ class Attribute extends AppModel
|
|||
}
|
||||
if (isset($attribute['Sighting']) && !empty($attribute['Sighting'])) {
|
||||
$this->Sighting = ClassRegistry::init('Sighting');
|
||||
foreach ($attribute['Sighting'] as $s) {
|
||||
$result = $this->Sighting->saveSightings($attribute['uuid'], false, $s['date_sighting'], $user, $s['type'], $s['source'], isset($s['uuid']) ? $s['uuid']: false);
|
||||
}
|
||||
$this->Sighting->captureSightings($attribute['Sighting'], $attribute['id'], $eventId, $user);
|
||||
}
|
||||
$fieldList = $this->editableFields;
|
||||
if (empty($existingAttribute)) {
|
||||
|
|
|
@ -154,6 +154,8 @@ class Sighting extends AppModel
|
|||
} else {
|
||||
$orgId = $this->Organisation->captureOrg($sighting['Organisation'], $user);
|
||||
}
|
||||
} else if (isset($user['org_id'])) {
|
||||
$orgId = $user['org_id'];
|
||||
}
|
||||
unset($sighting['id']);
|
||||
|
||||
|
|
Loading…
Reference in New Issue