chg: [feed] Show filtering on type only for server

pull/8271/head
Sami Mokaddem 2022-04-04 13:53:09 +02:00
parent 8d5f6e6662
commit bd24e875ee
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
4 changed files with 7 additions and 3 deletions

View File

@ -317,6 +317,7 @@ class FeedsController extends AppController
$this->set(compact('dropdownData'));
$this->set('defaultPullRules', json_encode(Feed::DEFAULT_FEED_PULL_RULES));
$this->set('menuData', array('menuList' => 'feeds', 'menuItem' => 'add'));
$this->set('pull_scope', 'feed');
}
private function __checkRegex($pattern)
@ -472,6 +473,7 @@ class FeedsController extends AppController
if(!empty($this->request->data['Feed']['rules'])){
$this->request->data['Feed']['pull_rules'] = $this->request->data['Feed']['rules'];
}
$this->set('pull_scope', 'feed');
$this->render('add');
}

View File

@ -455,6 +455,7 @@ class ServersController extends AppController
$this->set('allTags', $this->__getTags());
$this->set('host_org_id', Configure::read('MISP.host_org_id'));
$this->set('pull_scope', 'server');
$this->render('edit');
}
}
@ -649,6 +650,7 @@ class ServersController extends AppController
$this->set('server', $s);
$this->set('id', $id);
$this->set('host_org_id', Configure::read('MISP.host_org_id'));
$this->set('pull_scope', 'server');
}
}

View File

@ -782,7 +782,7 @@ class Feed extends AppModel
}
}
$url_params = !empty($filterRules['url_params']) ? $filterRules['url_params'] : [];
if (!$this->passesURLParamFilters($url_params, $event)) {
if (!$this->passesURLParamFilters($url_params, $event['Event'])) {
return false;
}
return true;

View File

@ -81,7 +81,7 @@
</div>
<?php
if (!empty(Configure::read('MISP.enable_synchronisation_filtering_on_type'))) {
if ($pull_scope == 'server' && !empty(Configure::read('MISP.enable_synchronisation_filtering_on_type'))) {
echo $this->element('serverRuleElements/rules_filtering_type', [
'technique' => 'pull',
'allowEmptyOptions' => true,
@ -115,7 +115,7 @@ echo $this->element('genericElements/assetLoader', array(
<script>
var pullRemoteRules404Error = '<?= __('Connection error or the remote version is not supporting remote filter lookups (v2.4.142+). Make sure that the remote instance is accessible and that it is up to date.') ?>'
var coreMirrorHints = <?= json_encode($coreMirrorHints) ?>;
var coreMirrorHints = <?= json_encode(!empty($coreMirrorHints) ? $coreMirrorHints : []) ?>;
var cm;
$(function() {
var serverID = "<?= isset($id) ? $id : '' ?>"