mirror of https://github.com/MISP/MISP
Add call to trigger before saving shadow attribute
parent
02de43a49e
commit
eca3cd9cbf
|
@ -196,6 +196,23 @@ class ShadowAttribute extends AppModel
|
|||
|
||||
// convert into utc and micro sec
|
||||
$this->data = $this->Attribute->ISODatetimeToUTC($this->data, $this->alias);
|
||||
|
||||
$trigger_id = 'shadow-attribute-before-save';
|
||||
$isTriggerCallable = $this->isTriggerCallable($trigger_id);
|
||||
if ($isTriggerCallable) {
|
||||
$triggerData = $this->data;
|
||||
$workflowErrors = [];
|
||||
$logging = [
|
||||
'model' => 'ShadowAttribute',
|
||||
'action' => 'add',
|
||||
'id' => $this->data['ShadowAttribute']['id'],
|
||||
'message' => __('The workflow `%s` prevented the saving of this proposal.', $trigger_id)
|
||||
];
|
||||
$workflowSuccess = $this->executeTrigger($trigger_id, $triggerData, $workflowErrors, $logging);
|
||||
if (!$workflowSuccess) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue