chg: allow option to disable correlations for all events coming from a feed

pull/8313/head
Luciano Righetti 2022-04-28 16:41:30 +02:00
parent 7cb610e331
commit 26c40ff35f
2 changed files with 19 additions and 1 deletions

View File

@ -384,6 +384,9 @@ class Feed extends AppModel
if (isset($feed['Feed']['settings'][$type])) {
$settings = $feed['Feed']['settings'][$type];
}
if (isset($feed['Feed']['settings']['disable_correlation'])) {
$settings['disable_correlation'] = (bool) $feed['Feed']['settings']['disable_correlation'];
}
if (isset($feed['Feed']['settings']['common'])) {
$settings = array_merge($settings, $feed['Feed']['settings']['common']);
}
@ -1025,6 +1028,11 @@ class Feed extends AppModel
if (!$this->__checkIfEventBlockedByFilter($event, $filterRules)) {
return 'blocked';
}
if (!empty($feed['Feed']['settings'])) {
if (!empty($feed['Feed']['settings']['disable_correlation'])) {
$event['Event']['disable_correlation'] = (bool) $feed['Feed']['settings']['disable_correlation'];
}
}
return $event;
}
@ -1225,6 +1233,10 @@ class Feed extends AppModel
if (!empty($feed['Feed']['orgc_id'])) {
$orgc_id = $feed['Feed']['orgc_id'];
}
$disableCorrelation = false;
if (!empty($feed['Feed']['settings'])) {
$disableCorrelation = (bool) $feed['Feed']['settings']['disable_correlation'] ?? false;
}
$event = array(
'info' => $feed['Feed']['name'] . ' feed',
'analysis' => 2,
@ -1234,7 +1246,8 @@ class Feed extends AppModel
'date' => date('Y-m-d'),
'distribution' => $feed['Feed']['distribution'],
'sharing_group_id' => $feed['Feed']['sharing_group_id'],
'user_id' => $user['id']
'user_id' => $user['id'],
'disable_correlation' => $disableCorrelation,
);
$result = $this->Event->save($event);
if (!$result) {

View File

@ -21,6 +21,11 @@ echo $this->element('genericElements/Form/genericForm', [
'label' => __('Lookup visible'),
'type' => 'checkbox'
],
[
'field' => 'Feed.settings.disable_correlation',
'label' => __('Disable correlation'),
'type' => 'checkbox'
],
[
'field' => 'name',
'label' => __('Name'),