mirror of https://github.com/MISP/MISP
chg: [galaxyClusterRelation] Make sure sourceCluster is always contained
parent
d608cb835c
commit
1cc35df4f0
|
@ -85,7 +85,7 @@ class GalaxyClusterRelationsController extends AppController
|
|||
$conditions = array('GalaxyClusterRelation.id' => $id);
|
||||
$relation = $this->GalaxyClusterRelation->fetchRelations($this->Auth->user(), array(
|
||||
'conditions' => $conditions,
|
||||
'contain' => array('SharingGroup', 'SourceCluster', 'TargetCluster', 'GalaxyClusterRelationTag' => array('Tag'))
|
||||
'contain' => array('SharingGroup', 'TargetCluster', 'GalaxyClusterRelationTag' => array('Tag'))
|
||||
));
|
||||
if (empty($relation)) {
|
||||
throw new NotFoundException(__('Invalid cluster relation'));
|
||||
|
@ -182,7 +182,7 @@ class GalaxyClusterRelationsController extends AppController
|
|||
|
||||
public function edit($id)
|
||||
{
|
||||
$conditions = array('conditions' => array('GalaxyClusterRelation.id' => $id), 'contain' => array('GalaxyClusterRelationTag' => 'Tag', 'SourceCluster'));
|
||||
$conditions = array('conditions' => array('GalaxyClusterRelation.id' => $id), 'contain' => array('GalaxyClusterRelationTag' => 'Tag'));
|
||||
$existingRelation = $this->GalaxyClusterRelation->fetchRelations($this->Auth->user(), $conditions);
|
||||
if (empty($existingRelation)) {
|
||||
throw new NotFoundException(__('Invalid cluster relation'));
|
||||
|
|
|
@ -987,7 +987,7 @@ class GalaxyClustersController extends AppController
|
|||
'conditions' => array(
|
||||
'GalaxyClusterRelation.galaxy_cluster_uuid' => $cluster['GalaxyCluster']['uuid']
|
||||
),
|
||||
'contain' => array('SharingGroup', 'SourceCluster', 'TargetCluster', 'GalaxyClusterRelationTag' => array('Tag'))
|
||||
'contain' => array('SharingGroup', 'TargetCluster', 'GalaxyClusterRelationTag' => array('Tag'))
|
||||
));
|
||||
$this->set('relations', $relations);
|
||||
$this->set('tree', $tree);
|
||||
|
|
|
@ -987,7 +987,6 @@ class GalaxyCluster extends AppModel
|
|||
'contain' => array(
|
||||
'GalaxyClusterRelationTag' => array('Tag'),
|
||||
'SharingGroup',
|
||||
'SourceCluster',
|
||||
),
|
||||
'conditions' => array(
|
||||
'TargetingClusterRelation.referenced_galaxy_cluster_id' => $cluster['GalaxyCluster']['id']
|
||||
|
|
|
@ -120,6 +120,9 @@ class GalaxyClusterRelation extends AppModel
|
|||
} elseif ($full) {
|
||||
$params['contain'] = array('SharingGroup', 'SourceCluster', 'TargetCluster');
|
||||
}
|
||||
if (!in_array('SourceCluster', $params['contain'])) {
|
||||
$params['contain'][] = 'SourceCluster';
|
||||
}
|
||||
if (isset($options['fields'])) {
|
||||
$params['fields'] = $options['fields'];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue