Default distribution level flags in bootstrap.php

- Each instance can now have its own default event and attribute distribution level set
pull/195/head
iglocska 2013-08-06 11:53:12 +02:00
parent aa66d5dece
commit 0ee45af902
6 changed files with 24 additions and 4 deletions

View File

@ -142,6 +142,8 @@ Configure::write('CyDefSIG.dns', 'false'); // there is a nameserver available
//Configure::write('MISP.welcome_text_bottom', 'instance'); // used in Events::login after the MISP logo //Configure::write('MISP.welcome_text_bottom', 'instance'); // used in Events::login after the MISP logo
//Configure::write('MISP.welcome_logo', 'organisation'); // used in Events::login to the left of the MISP logo, place a .png file in app/webroot/img with the name specified here. In this case it would be organisation.png //Configure::write('MISP.welcome_logo', 'organisation'); // used in Events::login to the left of the MISP logo, place a .png file in app/webroot/img with the name specified here. In this case it would be organisation.png
Configure::write('MISP.disablerestalert', 'false'); Configure::write('MISP.disablerestalert', 'false');
Configure::write('MISP.default_event_distribution', 3);
Configure::write('MISP.default_attribute_distribution', 3);
/** /**
* The settings below can be used to set additional paths to models, views and controllers. * The settings below can be used to set additional paths to models, views and controllers.

View File

@ -495,6 +495,9 @@ class AttributesController extends AppController {
$attribute['value'] = $entry['Value']; $attribute['value'] = $entry['Value'];
$attribute['to_ids'] = ($entry['Confidence'] > 51) ? 1 : 0; // To IDS if high confidence $attribute['to_ids'] = ($entry['Confidence'] > 51) ? 1 : 0; // To IDS if high confidence
$attribute['distribution'] = 3; // 'All communities' $attribute['distribution'] = 3; // 'All communities'
if (Configure::read('MISP.default_attribute_distribution') != null) {
$attribute['distribution'] = Configure::read('MISP.default_attribute_distribution');
}
switch($entry['Type']) { switch($entry['Type']) {
case 'Address': case 'Address':
$attribute['category'] = 'Network activity'; $attribute['category'] = 'Network activity';

View File

@ -1835,7 +1835,10 @@ class EventsController extends AppController {
$this->Event->read(null, $id); $this->Event->read(null, $id);
$saveEvent['Event'] = $this->Event->data['Event']; $saveEvent['Event'] = $this->Event->data['Event'];
$saveEvent['Event']['published'] = false; $saveEvent['Event']['published'] = false;
$dist = $this->Event->data['Event']['distribution']; $dist = 3;
if (Configure::read('MISP.default_attribute_distribution') != null) {
$dist = Configure::read('MISP.default_attribute_distribution');
}
// read XML // read XML
$event = $this->IOCImport->readXML($fileData, $id, $dist); $event = $this->IOCImport->readXML($fileData, $id, $dist);

View File

@ -11,10 +11,14 @@
'empty' => '(first choose category)' 'empty' => '(first choose category)'
)); ));
if ('true' == Configure::read('CyDefSIG.sync')) { if ('true' == Configure::read('CyDefSIG.sync')) {
$initialDistribution = 3;
if (Configure::read('MISP.default_attribute_distribution') != null) {
$initialDistribution = Configure::read('MISP.default_attribute_distribution');
}
echo $this->Form->input('distribution', array( echo $this->Form->input('distribution', array(
'options' => array($distributionLevels), 'options' => array($distributionLevels),
'label' => 'Distribution', 'label' => 'Distribution',
'selected' => $currentDist, 'selected' => $initialDistribution,
)); ));
} }
echo $this->Form->input('value', array( echo $this->Form->input('value', array(

View File

@ -8,10 +8,14 @@
'after' => $this->Html->div('forminfo', '', array('id' => 'AttributeCategoryDiv')), 'after' => $this->Html->div('forminfo', '', array('id' => 'AttributeCategoryDiv')),
)); ));
if ('true' == Configure::read('CyDefSIG.sync')) { if ('true' == Configure::read('CyDefSIG.sync')) {
$initialDistribution = 3;
if (Configure::read('MISP.default_attribute_distribution') != null) {
$initialDistribution = Configure::read('MISP.default_attribute_distribution');
}
echo $this->Form->input('distribution', array( echo $this->Form->input('distribution', array(
'options' => $distributionLevels, 'options' => $distributionLevels,
'label' => 'Distribution', 'label' => 'Distribution',
'selected' => $currentDist, 'selected' => $initialDistribution,
'after' => $this->Html->div('forminfo', '', array('id' => 'AttributeDistributionDiv')), 'after' => $this->Html->div('forminfo', '', array('id' => 'AttributeDistributionDiv')),
)); ));
//'before' => $this->Html->div('forminfo', isset($attrDescriptions['distribution']['formdesc']) ? $attrDescriptions['distribution']['formdesc'] : $attrDescriptions['distribution']['desc']),)); //'before' => $this->Html->div('forminfo', isset($attrDescriptions['distribution']['formdesc']) ? $attrDescriptions['distribution']['formdesc'] : $attrDescriptions['distribution']['desc']),));

View File

@ -7,11 +7,15 @@
'type' => 'text', 'type' => 'text',
'class' => 'datepicker' 'class' => 'datepicker'
)); ));
$initialDistribution = 3;
if (Configure::read('MISP.default_event_distribution') != null) {
$initialDistribution = Configure::read('MISP.default_event_distribution');
}
if ('true' == Configure::read('CyDefSIG.sync')) { if ('true' == Configure::read('CyDefSIG.sync')) {
echo $this->Form->input('distribution', array( echo $this->Form->input('distribution', array(
'options' => array($distributionLevels), 'options' => array($distributionLevels),
'label' => 'Distribution', 'label' => 'Distribution',
'selected' => '3', 'selected' => $initialDistribution,
)); ));
} }
echo $this->Form->input('risk', array( echo $this->Form->input('risk', array(