chg: [attackMatrix] ATT&CK Tactic is put at the top when picking

galaxies and is shown in All namespace mode
pull/3368/head
Sami Mokaddem 2018-06-22 05:56:31 +00:00
parent 2a91ed2876
commit 925a1dd3fa
1 changed files with 4 additions and 4 deletions

View File

@ -67,9 +67,9 @@ class GalaxiesController extends AppController {
public function selectGalaxy($target_id, $target_type='event', $namespace='misp') {
$expectedDescription = 'ATT&CK Tactic';
$conditions = $namespace == '0' ? array() : array('namespace' => $namespace);
if ($namespace == 'mitre-attack') {
if ($namespace == 'mitre-attack' || $namespace == '0') {
$conditions[] = array('description !=' => $expectedDescription);
$conditions2 = array('namespace' => $namespace);
$conditions2 = array('namespace' => 'mitre-attack');
$conditions2[] = array('description' => $expectedDescription);
$tacticGalaxies = $this->Galaxy->find('all', array(
@ -82,14 +82,14 @@ class GalaxiesController extends AppController {
'conditions' => $conditions,
));
if (!empty($tacticGalaxies)) {
$galaxies[] = array('Galaxy' => array(
array_unshift($galaxies, array('Galaxy' => array(
'id' => '-1',
'uuid' => '-1',
'name' => $expectedDescription,
'type' => '-1',
'icon' => '/img/mitre-attack-icon.ico',
'namespace' => 'mitre-attack'
));
)));
}
$this->set('galaxies', $galaxies);
$this->set('target_id', $target_id);