mirror of https://github.com/MISP/MISP
Merge pull request #7050 from JakubOnderka/cluster-relation
fix: [galaxy] GalaxyClusterRelation doesn't have Org and Orgcpull/7062/head
commit
2ec82ebea3
|
@ -4669,8 +4669,7 @@ class EventsController extends AppController
|
||||||
$this->loadModel('GalaxyCluster');
|
$this->loadModel('GalaxyCluster');
|
||||||
$clusters = $this->GalaxyCluster->fetchGalaxyClusters($this->Auth->user(), array('conditions' => array('GalaxyCluster.id' => $clusterIds)), $full=true);
|
$clusters = $this->GalaxyCluster->fetchGalaxyClusters($this->Auth->user(), array('conditions' => array('GalaxyCluster.id' => $clusterIds)), $full=true);
|
||||||
App::uses('ClusterRelationsGraphTool', 'Tools');
|
App::uses('ClusterRelationsGraphTool', 'Tools');
|
||||||
$grapher = new ClusterRelationsGraphTool();
|
$grapher = new ClusterRelationsGraphTool($this->Auth->user(), $this->GalaxyCluster);
|
||||||
$grapher->construct($this->Auth->user(), $this->GalaxyCluster);
|
|
||||||
$relations = $grapher->getNetwork($clusters, $keepNotLinkedClusters=true, $includeReferencingRelation=true);
|
$relations = $grapher->getNetwork($clusters, $keepNotLinkedClusters=true, $includeReferencingRelation=true);
|
||||||
if ($this->_isRest()) {
|
if ($this->_isRest()) {
|
||||||
return $this->RestResponse->viewData($relations, $this->response->type());
|
return $this->RestResponse->viewData($relations, $this->response->type());
|
||||||
|
|
|
@ -586,8 +586,7 @@ class GalaxiesController extends AppController
|
||||||
'conditions' => array('Galaxy.id' => $galaxyId)
|
'conditions' => array('Galaxy.id' => $galaxyId)
|
||||||
));
|
));
|
||||||
App::uses('ClusterRelationsGraphTool', 'Tools');
|
App::uses('ClusterRelationsGraphTool', 'Tools');
|
||||||
$grapher = new ClusterRelationsGraphTool();
|
$grapher = new ClusterRelationsGraphTool($this->Auth->user(), $this->Galaxy->GalaxyCluster);
|
||||||
$grapher->construct($this->Auth->user(), $this->Galaxy->GalaxyCluster);
|
|
||||||
$relations = $grapher->getNetwork($clusters);
|
$relations = $grapher->getNetwork($clusters);
|
||||||
if ($this->_isRest()) {
|
if ($this->_isRest()) {
|
||||||
return $this->RestResponse->viewData($relations, $this->response->type());
|
return $this->RestResponse->viewData($relations, $this->response->type());
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
class ClusterRelationsGraphTool
|
class ClusterRelationsGraphTool
|
||||||
{
|
{
|
||||||
private $GalaxyCluster = false;
|
private $GalaxyCluster;
|
||||||
private $user = false;
|
private $user;
|
||||||
private $lookup = array();
|
private $lookup = array();
|
||||||
|
|
||||||
public function construct($user, $GalaxyCluster)
|
public function __construct(array $user, GalaxyCluster $GalaxyCluster)
|
||||||
{
|
{
|
||||||
$this->GalaxyCluster = $GalaxyCluster;
|
$this->GalaxyCluster = $GalaxyCluster;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +74,7 @@
|
||||||
'conditions' => array(
|
'conditions' => array(
|
||||||
'referenced_galaxy_cluster_uuid' => $cluster['GalaxyCluster']['uuid']
|
'referenced_galaxy_cluster_uuid' => $cluster['GalaxyCluster']['uuid']
|
||||||
),
|
),
|
||||||
'contain' => array('Org', 'Orgc', 'SharingGroup'),
|
'contain' => array('SharingGroup'),
|
||||||
));
|
));
|
||||||
if (!empty($referencingRelations)) {
|
if (!empty($referencingRelations)) {
|
||||||
foreach ($referencingRelations as $relation) {
|
foreach ($referencingRelations as $relation) {
|
||||||
|
|
Loading…
Reference in New Issue