mirror of https://github.com/MISP/MISP
chg: [server:synchronisation] Usage of template_uuid instead of the object name
parent
9d104e941e
commit
3db4a4636b
|
@ -640,13 +640,16 @@ class ServersController extends AppController
|
|||
$allTypes = [];
|
||||
$this->loadModel('Attribute');
|
||||
$this->loadModel('ObjectTemplate');
|
||||
$objects = $this->ObjectTemplate->find('list', [
|
||||
'fields' => ['name'],
|
||||
'group' => ['name', 'id'],
|
||||
$objects = $this->ObjectTemplate->find('all', [
|
||||
'recursive' => -1,
|
||||
'fields' => ['uuid', 'name'],
|
||||
'group' => ['uuid', 'name', 'id'],
|
||||
]);
|
||||
$allTypes = [
|
||||
'attribute' => array_unique(Hash::extract(Hash::extract($this->Attribute->categoryDefinitions, '{s}.types'), '{n}.{n}')),
|
||||
'object' => $objects
|
||||
'object' => Hash::map($objects, '{n}.ObjectTemplate', function ($item) {
|
||||
return ['id' => $item['uuid'], 'name' => $item['name']];
|
||||
})
|
||||
];
|
||||
|
||||
$oldRemoteSetting = 0;
|
||||
|
|
|
@ -1149,7 +1149,7 @@ class Event extends AppModel
|
|||
$data['Object'][$key] = $this->__prepareAttributesForSync($data['Object'][$key], $server, $pushRules);
|
||||
}
|
||||
}
|
||||
if (!empty(Configure::read('MISP.enable_synchronisation_filtering_on_type')) && in_array($object['name'], $pushRules['type_objects']['NOT'])) {
|
||||
if (!empty(Configure::read('MISP.enable_synchronisation_filtering_on_type')) && in_array($object['template_uuid'], $pushRules['type_objects']['NOT'])) {
|
||||
unset($data['Object'][$key]);
|
||||
}
|
||||
$data['Object'] = array_values($data['Object']);
|
||||
|
|
|
@ -295,7 +295,7 @@ class Server extends AppModel
|
|||
}
|
||||
if (isset($event['Event']['Object'])) {
|
||||
foreach ($event['Event']['Object'] as $i => $object) {
|
||||
if (!empty(Configure::read('MISP.enable_synchronisation_filtering_on_type')) && in_array($object['name'], $pullRules['type_objects']['NOT'])) {
|
||||
if (!empty(Configure::read('MISP.enable_synchronisation_filtering_on_type')) && in_array($object['template_uuid'], $pullRules['type_objects']['NOT'])) {
|
||||
unset($event['Event']['Object'][$i]);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
]);
|
||||
?>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
if (!empty(Configure::read('MISP.enable_synchronisation_filtering_on_type'))) {
|
||||
echo $this->element('serverRuleElements/rules_filtering_type', [
|
||||
'technique' => 'push',
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
'technique' => $technique,
|
||||
'allowEmptyOptions' => true,
|
||||
'options' => $allObjectTypes,
|
||||
'optionNoValue' => true,
|
||||
'optionNoValue' => false,
|
||||
'initAllowOptions' => [],
|
||||
'initBlockOptions' => $objectTypeBlockRules,
|
||||
'disableAllow' => true,
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
<span id="push_orgs_NOT" style="display:none;"><?php echo __('Events with the following organisations blocked: ');?><span id="push_orgs_NOT_text" style="color:red;"></span><br /></span>
|
||||
<?php if(!empty(Configure::read('MISP.enable_synchronisation_filtering_on_type'))): ?>
|
||||
<span id="push_type_attributes_NOT" style="display:none;"><?php echo __('Attributes of the following types blocked: ');?><span id="push_type_attributes_NOT_text" style="color:red;"></span><br /></span>
|
||||
<span id="push_type_objects_NOT" style="display:none;"><?php echo __('Objects of the following names blocked: ');?><span id="push_type_objects_NOT_text" style="color:red;"></span><br /></span>
|
||||
<span id="push_type_objects_NOT" style="display:none;"><?php echo __('Objects of the following uuids blocked: ');?><span id="push_type_objects_NOT_text" style="color:red;"></span><br /></span>
|
||||
<?php endif; ?>
|
||||
<span id="push_modify" class="btn btn-inverse" style="line-height:10px; padding: 4px 4px;"><?php echo __('Modify');?></span><br /><br />
|
||||
<b><?php echo __('Pull rules:');?></b><br />
|
||||
|
@ -169,7 +169,7 @@
|
|||
<span id="pull_orgs_NOT" style="display:none;"><?php echo __('Events with the following organisations blocked: ');?><span id="pull_orgs_NOT_text" style="color:red;"></span><br /></span>
|
||||
<?php if(!empty(Configure::read('MISP.enable_synchronisation_filtering_on_type'))): ?>
|
||||
<span id="pull_type_attributes_NOT" style="display:none;"><?php echo __('Attributes of the following types blocked: ');?><span id="pull_type_attributes_NOT_text" style="color:red;"></span><br /></span>
|
||||
<span id="pull_type_objects_NOT" style="display:none;"><?php echo __('Objects of the following names blocked: ');?><span id="pull_type_objects_NOT_text" style="color:red;"></span><br /></span>
|
||||
<span id="pull_type_objects_NOT" style="display:none;"><?php echo __('Objects of the following uuids blocked: ');?><span id="pull_type_objects_NOT_text" style="color:red;"></span><br /></span>
|
||||
<?php endif; ?>
|
||||
<span id="pull_url_params" style="display:none;"><?php echo __('Additional parameters: ');?><span id="pull_url_params_text" style="color:green;"></span><br /></span>
|
||||
<span id="pull_modify" class="btn btn-inverse" style="line-height:10px; padding: 4px 4px;"><?php echo __('Modify');?></span><br /><br />
|
||||
|
|
Loading…
Reference in New Issue