mirror of https://github.com/MISP/MISP
chg: [clusterRelations:add] Force no galaxy matrix when picking clusters
parent
64c8ccfeec
commit
b9b08ae17e
|
@ -266,7 +266,7 @@ class GalaxiesController extends AppController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function selectGalaxy($target_id, $target_type='event', $namespace='misp')
|
public function selectGalaxy($target_id, $target_type='event', $namespace='misp', $noGalaxyMatrix = false)
|
||||||
{
|
{
|
||||||
$mitreAttackGalaxyId = $this->Galaxy->getMitreAttackGalaxyId();
|
$mitreAttackGalaxyId = $this->Galaxy->getMitreAttackGalaxyId();
|
||||||
$local = !empty($this->params['named']['local']) ? $this->params['named']['local'] : '0';
|
$local = !empty($this->params['named']['local']) ? $this->params['named']['local'] : '0';
|
||||||
|
@ -285,7 +285,7 @@ class GalaxiesController extends AppController
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
foreach ($galaxies as $galaxy) {
|
foreach ($galaxies as $galaxy) {
|
||||||
if (!isset($galaxy['Galaxy']['kill_chain_order'])) {
|
if (!isset($galaxy['Galaxy']['kill_chain_order']) || $noGalaxyMatrix) {
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'name' => h($galaxy['Galaxy']['name']),
|
'name' => h($galaxy['Galaxy']['name']),
|
||||||
'value' => "/galaxies/selectCluster/" . $target_id . '/' . $target_type . '/' . $galaxy['Galaxy']['id'] . '/local:' . $local,
|
'value' => "/galaxies/selectCluster/" . $target_id . '/' . $target_type . '/' . $galaxy['Galaxy']['id'] . '/local:' . $local,
|
||||||
|
@ -319,7 +319,7 @@ class GalaxiesController extends AppController
|
||||||
$this->render('/Elements/generic_picker');
|
$this->render('/Elements/generic_picker');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function selectGalaxyNamespace($target_id, $target_type='event')
|
public function selectGalaxyNamespace($target_id, $target_type='event', $noGalaxyMatrix = false)
|
||||||
{
|
{
|
||||||
$namespaces = $this->Galaxy->find('list', array(
|
$namespaces = $this->Galaxy->find('list', array(
|
||||||
'recursive' => -1,
|
'recursive' => -1,
|
||||||
|
@ -331,12 +331,12 @@ class GalaxiesController extends AppController
|
||||||
$items = array();
|
$items = array();
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'name' => __('All namespaces'),
|
'name' => __('All namespaces'),
|
||||||
'value' => "/galaxies/selectGalaxy/" . $target_id . '/' . $target_type . '/0' . '/local:' . $local
|
'value' => "/galaxies/selectGalaxy/" . $target_id . '/' . $target_type . '/0' . '/' . $noGalaxyMatrix . '/local:' . $local
|
||||||
);
|
);
|
||||||
foreach ($namespaces as $namespace) {
|
foreach ($namespaces as $namespace) {
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'name' => $namespace,
|
'name' => $namespace,
|
||||||
'value' => "/galaxies/selectGalaxy/" . $target_id . '/' . $target_type . '/' . $namespace . '/local:' . $local
|
'value' => "/galaxies/selectGalaxy/" . $target_id . '/' . $target_type . '/' . $namespace . '/' . $noGalaxyMatrix . '/local:' . $local
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,14 +74,16 @@
|
||||||
$(this).data('popover-callback-function', setSourceUUIDAfterSelect);
|
$(this).data('popover-callback-function', setSourceUUIDAfterSelect);
|
||||||
var target_id = 0;
|
var target_id = 0;
|
||||||
var target_type = 'galaxyClusterRelation';
|
var target_type = 'galaxyClusterRelation';
|
||||||
popoverPopup(this, target_id + '/' + target_type, 'galaxies', 'selectGalaxyNamespace');
|
var noGalaxyMatrix = 1;
|
||||||
|
popoverPopup(this, target_id + '/' + target_type + '/' + noGalaxyMatrix, 'galaxies', 'selectGalaxyNamespace');
|
||||||
}
|
}
|
||||||
function pickerTarget() {
|
function pickerTarget() {
|
||||||
$(this).data('popover-no-submit', true);
|
$(this).data('popover-no-submit', true);
|
||||||
$(this).data('popover-callback-function', setTargetUUIDAfterSelect);
|
$(this).data('popover-callback-function', setTargetUUIDAfterSelect);
|
||||||
var target_id = 0;
|
var target_id = 0;
|
||||||
var target_type = 'galaxyClusterRelation';
|
var target_type = 'galaxyClusterRelation';
|
||||||
popoverPopup(this, target_id + '/' + target_type, 'galaxies', 'selectGalaxyNamespace');
|
var noGalaxyMatrix = 1;
|
||||||
|
popoverPopup(this, target_id + '/' + target_type + '/' + noGalaxyMatrix, 'galaxies', 'selectGalaxyNamespace');
|
||||||
}
|
}
|
||||||
function pickerTags() {
|
function pickerTags() {
|
||||||
$(this).data('popover-no-submit', true);
|
$(this).data('popover-no-submit', true);
|
||||||
|
@ -90,15 +92,15 @@
|
||||||
var target_type = 'galaxyClusterRelation';
|
var target_type = 'galaxyClusterRelation';
|
||||||
popoverPopup(this, target_id + '/' + target_type, 'tags', 'selectTaxonomy')
|
popoverPopup(this, target_id + '/' + target_type, 'tags', 'selectTaxonomy')
|
||||||
}
|
}
|
||||||
function setSourceUUIDAfterSelect(selected, additionalData){
|
function setSourceUUIDAfterSelect(selected, additionalData) {
|
||||||
selectedUUID = additionalData.itemOptions[selected].uuid;
|
selectedUUID = additionalData.itemOptions[selected].uuid;
|
||||||
$('#GalaxyClusterRelationGalaxyClusterUuid').val(selectedUUID);
|
$('#GalaxyClusterRelationGalaxyClusterUuid').val(selectedUUID);
|
||||||
}
|
}
|
||||||
function setTargetUUIDAfterSelect(selected, additionalData){
|
function setTargetUUIDAfterSelect(selected, additionalData) {
|
||||||
selectedUUID = additionalData.itemOptions[selected].uuid;
|
selectedUUID = additionalData.itemOptions[selected].uuid;
|
||||||
$('#GalaxyClusterRelationReferencedGalaxyClusterUuid').val(selectedUUID);
|
$('#GalaxyClusterRelationReferencedGalaxyClusterUuid').val(selectedUUID);
|
||||||
}
|
}
|
||||||
function setTagsAfterSelect(selected, additionalData){
|
function setTagsAfterSelect(selected, additionalData) {
|
||||||
selectedTags = [];
|
selectedTags = [];
|
||||||
selected.forEach(function(selection) {
|
selected.forEach(function(selection) {
|
||||||
selectedTags.push(additionalData.itemOptions[selection].tag_name);
|
selectedTags.push(additionalData.itemOptions[selection].tag_name);
|
||||||
|
|
Loading…
Reference in New Issue