chg: [cryptographickey] execute key update on add()

pull/8213/head
iglocska 2022-03-13 15:13:32 +01:00
parent 951e95ed5d
commit 4c381157a6
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 8 additions and 1 deletions

View File

@ -3478,9 +3478,10 @@ class Event extends AppModel
if (isset($event['distribution']) && $event['distribution'] == 4) {
$event = $this->captureSGForElement($event, $user, $server);
}
if (!empty($event['Attribute'])) {
foreach ($event['Attribute'] as $k => $a) {
unset($event['Attribute']['id']);
unset($event['Attribute'][$k]['id']);
if (isset($a['distribution']) && $a['distribution'] == 4) {
$event['Attribute'][$k] = $this->captureSGForElement($a, $user, $server);
}
@ -3945,6 +3946,12 @@ class Event extends AppModel
$result = $this->EventReport->captureReport($user, $report, $this->id);
}
}
// capture new keys, update existing, remove those no longer in the pushed data
if (!empty($data['Event']['CryptographicKey'])) {
$this->captureCryptographicKeyUpdate($data['Event']['CryptographicKey'], $data['Event']['id'], 'Event');
}
// zeroq: check if sightings are attached and add to event
if (isset($data['Sighting']) && !empty($data['Sighting'])) {
$this->Sighting->captureSightings($data['Sighting'], null, $this->id, $user);