mirror of https://github.com/MISP/MISP
new: [correlation exclusions] now have an optional comment field
- explain why you exclude a value for easier maintenance - edit existing exclusions to add those comments after the factpull/7377/head
parent
94afe67d68
commit
d61ebc9905
|
@ -22,8 +22,8 @@ class CorrelationExclusionsController extends AppController
|
|||
public function index($id = false)
|
||||
{
|
||||
$this->CRUD->index([
|
||||
'filters' => ['value'],
|
||||
'quickFilters' => ['value']
|
||||
'filters' => ['value', 'comment'],
|
||||
'quickFilters' => ['value', 'comment']
|
||||
]);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
|
@ -46,12 +46,15 @@ class CorrelationExclusionsController extends AppController
|
|||
public function add()
|
||||
{
|
||||
$options = [
|
||||
'filters' => ['value', 'redirect', 'redirect_controller']
|
||||
'filters' => ['value', 'redirect', 'redirect_controller', 'comment']
|
||||
];
|
||||
$params = $this->IndexFilter->harvestParameters($options['filters']);
|
||||
if (!empty($params['value'])) {
|
||||
$this->request->data['CorrelationExclusion']['value'] = $params['value'];
|
||||
}
|
||||
if (!empty($params['comment'])) {
|
||||
$this->request->data['CorrelationExclusion']['value'] = $params['comment'];
|
||||
}
|
||||
$this->CRUD->add($params);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
|
@ -64,6 +67,34 @@ class CorrelationExclusionsController extends AppController
|
|||
]);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->set('menuData', [
|
||||
'menuList' => 'correlationExclusions',
|
||||
'menuItem' => 'edit',
|
||||
]);
|
||||
$this->set('id', $id);
|
||||
$params = [
|
||||
'fields' => ['comment']
|
||||
];
|
||||
$this->CRUD->edit($id, $params);
|
||||
if ($this->IndexFilter->isRest()) {
|
||||
return $this->restResponsePayload;
|
||||
}
|
||||
|
||||
$this->loadModel('Organisation');
|
||||
$orgs = $this->Organisation->find('list', [
|
||||
'recursive' => -1,
|
||||
'fields' => ['id', 'name'],
|
||||
'order' => ['lower(name)' => 'ASC']
|
||||
]);
|
||||
$dropdownData = [
|
||||
'org_id' => $orgs
|
||||
];
|
||||
$this->set(compact('dropdownData'));
|
||||
$this->render('add');
|
||||
}
|
||||
|
||||
public function view($id = false)
|
||||
{
|
||||
$this->CRUD->view($id);
|
||||
|
|
|
@ -89,7 +89,7 @@ class AppModel extends Model
|
|||
45 => false, 46 => false, 47 => false, 48 => false, 49 => false, 50 => false,
|
||||
51 => false, 52 => false, 53 => false, 54 => false, 55 => false, 56 => false,
|
||||
57 => false, 58 => false, 59 => false, 60 => false, 61 => false, 62 => false,
|
||||
63 => true, 64 => false, 65 => false, 66 => false, 67 => false,
|
||||
63 => true, 64 => false, 65 => false, 66 => false, 67 => false, 68 => false
|
||||
);
|
||||
|
||||
public $advanced_updates_description = array(
|
||||
|
@ -1575,6 +1575,9 @@ class AppModel extends Model
|
|||
case 67:
|
||||
$sqlArray[] = "ALTER TABLE `auth_keys` ADD `allowed_ips` text DEFAULT NULL;";
|
||||
break;
|
||||
case 68:
|
||||
$sqlArray[] = "ALTER TABLE `correlation_exclusions` ADD `comment` text DEFAULT NULL;";
|
||||
break;
|
||||
case 'fixNonEmptySharingGroupID':
|
||||
$sqlArray[] = 'UPDATE `events` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
|
||||
$sqlArray[] = 'UPDATE `attributes` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
<?php
|
||||
echo $this->element('genericElements/Form/genericForm', [
|
||||
'data' => [
|
||||
'title' => __('Add Correlation Exclusion Entry'),
|
||||
'title' => $this->action === 'add' ? __('Add Correlation Exclusion Entry') : __('Edit Correlation Exclusion Entry'),
|
||||
'description' => __('If you wish to exclude certain entries from being correlated on, simply add an entry here.'),
|
||||
'fields' => [
|
||||
[
|
||||
'field' => 'value',
|
||||
'label' => __('Value'),
|
||||
'class' => 'span6',
|
||||
'requirements' => $this->action === 'add'
|
||||
],
|
||||
[
|
||||
'field' => 'comment',
|
||||
'label' => __('Comment'),
|
||||
'class' => 'span6',
|
||||
]
|
||||
],
|
||||
'submit' => [
|
||||
|
|
|
@ -60,6 +60,10 @@
|
|||
'sort' => 'CorrelationExclusion.value',
|
||||
'data_path' => 'CorrelationExclusion.value',
|
||||
],
|
||||
[
|
||||
'name' => 'Comment',
|
||||
'data_path' => 'CorrelationExclusion.comment',
|
||||
],
|
||||
[
|
||||
'name' => 'JSON source',
|
||||
'sort' => 'CorrelationExclusion.from_json',
|
||||
|
@ -72,6 +76,15 @@
|
|||
'description' => empty($ajax) ? __('A list of values to exclude from the correlation engine.') : false,
|
||||
'pull' => 'right',
|
||||
'actions' => [
|
||||
[
|
||||
'onclick' => sprintf(
|
||||
'openGenericModal(\'%s/correlation_exclusions/edit/[onclick_params_data_path]\');',
|
||||
$baseurl
|
||||
),
|
||||
'onclick_params_data_path' => 'CorrelationExclusion.id',
|
||||
'icon' => 'edit',
|
||||
'title' => __('Edit exclusion entry'),
|
||||
],
|
||||
[
|
||||
'onclick' => sprintf(
|
||||
'openGenericModal(\'%s/correlation_exclusions/delete/[onclick_params_data_path]\');',
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
echo sprintf('<div%s>', empty($ajax) ? ' class="index"' : '');
|
||||
|
||||
echo $this->element('genericElements/IndexTable/index_table', [
|
||||
'data' => [
|
||||
'stupid_pagination' => 1,
|
||||
|
|
Loading…
Reference in New Issue