mirror of https://github.com/MISP/MISP
fix: Various fixes to the feed system
- allow users to override the IDS flags and keep all attributes pulled from a freetext feed IDS = off - UI changes - fix to a bug that caused already deleted attributes to be counted as existing onespull/1580/merge
parent
a6cb34e4a3
commit
9649c608b4
|
@ -87,7 +87,7 @@ class FeedsController extends AppController {
|
|||
}
|
||||
}
|
||||
$this->request->data['Feed']['event_id'] = $this->request->data['Feed']['fixed_event'] ? $this->request->data['Feed']['target_event'] : 0;
|
||||
$fields = array('id', 'name', 'provider', 'enabled', 'rules', 'url', 'distribution', 'sharing_group_id', 'tag_id', 'fixed_event', 'event_id', 'publish', 'delta_merge');
|
||||
$fields = array('id', 'name', 'provider', 'enabled', 'rules', 'url', 'distribution', 'sharing_group_id', 'tag_id', 'fixed_event', 'event_id', 'publish', 'delta_merge', 'override_ids');
|
||||
$feed = array();
|
||||
foreach ($fields as $field) $feed[$field] = $this->request->data['Feed'][$field];
|
||||
$result = $this->Feed->save($feed);
|
||||
|
|
|
@ -439,6 +439,7 @@ class AppModel extends Model {
|
|||
$sqlArray[] = 'ALTER TABLE feeds ADD delta_merge tinyint(1) NOT NULL DEFAULT 0;';
|
||||
$sqlArray[] = 'ALTER TABLE feeds ADD event_id int(11) NOT NULL DEFAULT 0;';
|
||||
$sqlArray[] = 'ALTER TABLE feeds ADD publish tinyint(1) NOT NULL DEFAULT 0;';
|
||||
$sqlArray[] = 'ALTER TABLE feeds ADD override_ids tinyint(1) NOT NULL DEFAULT 0;';
|
||||
$sqlArray[] = "ALTER TABLE feeds ADD settings text NOT NULL DEFAULT '';";
|
||||
break;
|
||||
case 'fixNonEmptySharingGroupID':
|
||||
|
|
|
@ -444,7 +444,7 @@ class Feed extends AppModel {
|
|||
}
|
||||
}
|
||||
if ($feed['Feed']['fixed_event'] && $feed['Feed']['delta_merge']) {
|
||||
$event = $this->Event->find('first', array('conditions' => array('Event.id' => $event['Event']['id']), 'recursive' => -1, 'contain' => array('Attribute')));
|
||||
$event = $this->Event->find('first', array('conditions' => array('Event.id' => $event['Event']['id']), 'recursive' => -1, 'contain' => array('Attribute' => array('conditions' => array('Attribute.deleted' => 0)))));
|
||||
$to_delete = array();
|
||||
foreach ($data as $k => $dataPoint) {
|
||||
foreach ($event['Attribute'] as $attribute_key => $attribute) {
|
||||
|
@ -465,6 +465,7 @@ class Feed extends AppModel {
|
|||
$data[$key]['event_id'] = $event['Event']['id'];
|
||||
$data[$key]['distribution'] = $feed['Feed']['distribution'];
|
||||
$data[$key]['sharing_group_id'] = $feed['Feed']['sharing_group_id'];
|
||||
$data[$key]['to_ids'] = $feed['Feed']['override_ids'] ? 0 : $data[$key]['to_ids'];
|
||||
}
|
||||
if (!$this->Event->Attribute->saveMany($data)) {
|
||||
return 'Could not save the parsed attributes.';
|
||||
|
|
|
@ -57,6 +57,16 @@
|
|||
));
|
||||
?>
|
||||
</div>
|
||||
<div id="OverrideIdsDiv" class="input clear">
|
||||
<?php
|
||||
echo $this->Form->input('override_ids', array(
|
||||
'label' => 'Override IDS Flag',
|
||||
'title' => 'If checked, the IDS flags will always be set to off when pulling from this feed',
|
||||
'type' => 'checkbox',
|
||||
'class' => 'form-control'
|
||||
));
|
||||
?>
|
||||
</div>
|
||||
<div id="DeltaMergeDiv" class="input clear">
|
||||
<?php
|
||||
echo $this->Form->input('delta_merge', array(
|
||||
|
@ -140,8 +150,11 @@ function feedFormUpdate() {
|
|||
$('#TargetDiv').hide();
|
||||
$('#TargetEventDiv').hide();
|
||||
$('#PublishDiv').hide();
|
||||
$('#OverrideIdsDiv').hide();
|
||||
$('#DeltaMergeDiv').hide();
|
||||
} else if ($('#FeedSourceFormat').val() == 'freetext') {
|
||||
$('#TargetDiv').show();
|
||||
$('#OverrideIdsDiv').show();
|
||||
$('#PublishDiv').show();
|
||||
if ($('#FeedTarget').val() == 0) {
|
||||
$('#TargetEventDiv').hide();
|
||||
|
|
|
@ -56,6 +56,16 @@
|
|||
));
|
||||
?>
|
||||
</div>
|
||||
<div id="OverrideIdsDiv" class="input clear">
|
||||
<?php
|
||||
echo $this->Form->input('override_ids', array(
|
||||
'label' => 'Override IDS Flag',
|
||||
'title' => 'If checked, the IDS flags will always be set to off when pulling from this feed',
|
||||
'type' => 'checkbox',
|
||||
'class' => 'form-control'
|
||||
));
|
||||
?>
|
||||
</div>
|
||||
<div id="DeltaMergeDiv" class="input clear">
|
||||
<?php
|
||||
echo $this->Form->input('delta_merge', array(
|
||||
|
@ -149,10 +159,12 @@ function feedFormUpdate() {
|
|||
$('#TargetDiv').hide();
|
||||
$('#TargetEventDiv').hide();
|
||||
$('#PublishDiv').hide();
|
||||
$('#OverrideIdsDiv').hide();
|
||||
} else if ($('#FeedSourceFormat').val() == 'freetext') {
|
||||
$('#TargetDiv').show();
|
||||
$('#OverrideIdsDiv').show();
|
||||
$('#PublishDiv').show();
|
||||
if ($('#FeedFixedEvent').val() == 0) {
|
||||
if ($('#FeedTarget').val() == 0) {
|
||||
$('#TargetEventDiv').hide();
|
||||
$('#DeltaMergeDiv').hide();
|
||||
} else {
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<th>Target</th>
|
||||
<th>Publish</th>
|
||||
<th>Delta Merge</th>
|
||||
<th>Override IDS</th>
|
||||
<th><?php echo $this->Paginator->sort('distribution');?></th>
|
||||
<th><?php echo $this->Paginator->sort('tag');?></th>
|
||||
<th><?php echo $this->Paginator->sort('enabled');?></th>
|
||||
|
@ -85,28 +86,21 @@ foreach ($feeds as $item):
|
|||
endif;
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($item['Feed']['source_format'] == 'freetext'):
|
||||
?>
|
||||
<span class="<?php echo ($item['Feed']['publish'] ? 'icon-ok' : 'icon-remove'); ?>"></span>
|
||||
<?php
|
||||
else:
|
||||
echo ' ';
|
||||
endif;
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($item['Feed']['source_format'] == 'freetext'):
|
||||
?>
|
||||
<span class="<?php echo ($item['Feed']['delta_merge'] ? 'icon-ok' : 'icon-remove'); ?>"></span>
|
||||
<?php
|
||||
else:
|
||||
echo ' ';
|
||||
endif;
|
||||
?>
|
||||
</td>
|
||||
<?php
|
||||
if ($item['Feed']['source_format'] == 'freetext'):
|
||||
?>
|
||||
<td><span class="<?php echo ($item['Feed']['publish'] ? 'icon-ok' : 'icon-remove'); ?>"></span></td>
|
||||
<td><span class="<?php echo ($item['Feed']['delta_merge'] ? 'icon-ok' : 'icon-remove'); ?>"></span></td>
|
||||
<td><span class="<?php echo ($item['Feed']['override_ids'] ? 'icon-ok' : 'icon-remove'); ?>"></span></td>
|
||||
<?php
|
||||
else:
|
||||
?>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
<td <?php if ($item['Feed']['distribution'] == 0) echo 'class="red"'; ?>>
|
||||
<?php
|
||||
echo $item['Feed']['distribution'] == 4 ? '<a href="' . $baseurl . '/sharing_groups/view/' . h($item['SharingGroup']['id']) . '">' . h($item['SharingGroup']['name']) . '</a>' : $distributionLevels[$item['Feed']['distribution']] ;
|
||||
|
|
Loading…
Reference in New Issue