mirror of https://github.com/MISP/MISP
new: [workflow:trigger_event_after_save] New trigger Event.afterSave
parent
8f1b07d698
commit
7f5ce84288
|
@ -459,6 +459,17 @@ class Event extends AppModel
|
|||
if (empty($event['unpublishAction']) && empty($event['skip_kafka'])) {
|
||||
$this->publishKafkaNotification('event', $this->quickFetchEvent($event['id']), $created ? 'add' : 'edit');
|
||||
}
|
||||
if ($this->isTriggerCallable('event-after-save')) {
|
||||
$event = $this->quickFetchEvent($event['id']);
|
||||
$workflowErrors = [];
|
||||
$logging = [
|
||||
'model' => 'Event',
|
||||
'action' => $created ? 'add' : 'edit',
|
||||
'id' => $event['Event']['id'],
|
||||
];
|
||||
$triggerData = $event;
|
||||
$this->executeTrigger('event-after-save', $triggerData, $workflowErrors, $logging);
|
||||
}
|
||||
}
|
||||
|
||||
public function attachTagsToEvents(array $events)
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
include_once APP . 'Model/WorkflowModules/WorkflowBaseModule.php';
|
||||
|
||||
class Module_event_after_save extends WorkflowBaseTriggerModule
|
||||
{
|
||||
public $id = 'event-after-save';
|
||||
public $scope = 'event';
|
||||
public $name = 'Event After Save';
|
||||
public $description = 'This trigger is called after an Event has been saved in the database';
|
||||
public $icon = 'envelope';
|
||||
public $inputs = 0;
|
||||
public $outputs = 1;
|
||||
public $blocking = false;
|
||||
public $misp_core_format = true;
|
||||
public $trigger_overhead = self::OVERHEAD_MEDIUM;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->trigger_overhead_message = __('This trigger is called each time an Event has been saved. Generally, the performance impact of running the workflow is low but in some cases (e.g. Very active community or frequent synchronisations) it can introduce a slight slowdown of the instance.');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue