mirror of https://github.com/MISP/MISP
Added the server filters to the server creation
parent
da3e35952a
commit
326d62d822
|
@ -137,6 +137,19 @@ class ServersController extends AppController {
|
|||
$this->set('organisationOptions', $organisationOptions);
|
||||
$this->set('localOrganisations', $localOrganisations);
|
||||
$this->set('externalOrganisations', $externalOrganisations);
|
||||
|
||||
// list all orgs for the rule picker
|
||||
$temp = $localOrganisations + $externalOrganisations;
|
||||
$allOrgs = array();
|
||||
foreach ($temp as $k => $v) $allOrgs[] = array('id' => $k, 'name' => $v);
|
||||
$this->set('allOrganisations', $allOrgs);
|
||||
|
||||
// list all tags for the rule picker
|
||||
$this->loadModel('Tag');
|
||||
$temp = $this->Tag->find('all', array('recursive' => -1));
|
||||
$allTags = array();
|
||||
foreach ($temp as $t) $allTags[] = array('id' => $t['Tag']['id'], 'name' => $t['Tag']['name']);
|
||||
$this->set('allTags', $allTags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,7 +180,6 @@ class ServersController extends AppController {
|
|||
$fail = true;
|
||||
$this->Session->setFlash(__('The push filter rules must be in valid JSON format.'));
|
||||
}
|
||||
|
||||
if (!$fail) {
|
||||
// say what fields are to be updated
|
||||
$fieldList = array('id', 'url', 'push', 'pull', 'remote_org_id', 'name' ,'self_signed', 'cert_file', 'push_rules', 'pull_rules');
|
||||
|
|
|
@ -68,13 +68,13 @@
|
|||
<span id="push_tags_blocked" style="display:none;">Events with the following tags blocked: <span id="push_tags_blocked_text" style="color:red;"></span><br /></span>
|
||||
<span id="push_orgs_allowed" style="display:none;">Events with the following organisations allowed: <span id="push_orgs_allowed_text" style="color:green;"></span><br /></span>
|
||||
<span id="push_orgs_blocked" style="display:none;">Events with the following organisations blocked: <span id="push_orgs_blocked_text" style="color:red;"></span><br /></span>
|
||||
<span class="btn btn-inverse" style="line-height:10px; padding: 4px 4px;">Modify</span><br /><br />
|
||||
<span id="push_modify" class="btn btn-inverse" style="line-height:10px; padding: 4px 4px;">Modify</span><br /><br />
|
||||
<b>Pull rules:</b><br />
|
||||
<span id="pull_tags_allowed" style="display:none;">Events with the following tags allowed: <span id="pull_tags_allowed_text" style="color:green;"></span><br /></span>
|
||||
<span id="pull_tags_blocked" style="display:none;">Events with the following tags blocked: <span id="pull_tags_blocked_text" style="color:red;"></span><br /></span>
|
||||
<span id="pull_orgs_allowed" style="display:none;">Events with the following organisations allowed: <span id="pull_orgs_allowed_text" style="color:green;"></span><br /></span>
|
||||
<span id="pull_orgs_blocked" style="display:none;">Events with the following organisations blocked: <span id="pull_orgs_blocked_text" style="color:red;"></span><br /></span>
|
||||
<span class="btn btn-inverse" style="line-height:10px; padding: 4px 4px;">Modify</span><br /><br />
|
||||
<span id="pull_modify" class="btn btn-inverse" style="line-height:10px; padding: 4px 4px;">Modify</span><br /><br />
|
||||
<?php
|
||||
echo $this->Form->input('push_rules', array('style' => 'display:none;', 'label' => false, 'div' => false));
|
||||
echo $this->Form->input('pull_rules', array('style' => 'display:none;', 'label' => false, 'div' => false));
|
||||
|
@ -86,6 +86,10 @@
|
|||
echo $this->Form->end();
|
||||
?>
|
||||
</div>
|
||||
<div id="hiddenRuleForms">
|
||||
<?php echo $this->element('serverRuleElements/push'); ?>
|
||||
<?php echo $this->element('serverRuleElements/pull'); ?>
|
||||
</div>
|
||||
<?php
|
||||
echo $this->element('side_menu', array('menuList' => 'sync', 'menuItem' => 'add'));
|
||||
?>
|
||||
|
@ -103,6 +107,13 @@ var formInfoValues = {
|
|||
'ServerSelfSigned' : "Click this, if you would like to allow a connection despite the other instance using a self-signed certificate (not recommended)."
|
||||
};
|
||||
|
||||
|
||||
var rules = {"push": {"tags": {"allowed":[], "blocked":[]}, "orgs": {"allowed":[], "blocked":[]}}, "pull": {"tags": {"allowed":[], "blocked":[]}, "orgs": {"allowed":[], "blocked":[]}}};
|
||||
var validOptions = ['pull', 'push'];
|
||||
var validFields = ['tags', 'orgs'];
|
||||
var tags = <?php echo json_encode($allTags); ?>;
|
||||
var orgs = <?php echo json_encode($allOrganisations); ?>;
|
||||
|
||||
$(document).ready(function() {
|
||||
serverOrgTypeChange();
|
||||
$('#ServerOrganisationType').change(function() {
|
||||
|
@ -122,5 +133,13 @@ $(document).ready(function() {
|
|||
content: formInfoValues[e.currentTarget.id],
|
||||
}).popover('show');
|
||||
});
|
||||
|
||||
serverRulePopulateTagPicklist();
|
||||
$("#push_modify").click(function() {
|
||||
serverRuleFormActivate('push');
|
||||
});
|
||||
$("#pull_modify").click(function() {
|
||||
serverRuleFormActivate('pull');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -145,7 +145,6 @@ $(document).ready(function() {
|
|||
}).popover('show');
|
||||
});
|
||||
rules = convertServerFilterRules(rules);
|
||||
rules = convertServerFilterRules(rules);
|
||||
serverRulePopulateTagPicklist();
|
||||
$("#push_modify").click(function() {
|
||||
serverRuleFormActivate('push');
|
||||
|
|
Loading…
Reference in New Issue