chg: [galaxyCluster:add] Allow adding cluster with galaxy uuid

pull/6120/head
mokaddem 2020-06-11 15:13:24 +02:00
parent a9039f023a
commit b5b9441435
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 13 additions and 0 deletions

View File

@ -229,6 +229,19 @@ class GalaxyClustersController extends AppController
public function add($galaxyId)
{
if (Validation::uuid($galaxyId)) {
$temp = $this->GalaxyCluster->Galaxy->find('first', array(
'recursive' => -1,
'fields' => array('Galaxy.id', 'Galaxy.uuid'),
'conditions' => array('Galaxy.uuid' => $galaxyId)
));
if ($temp === null) {
throw new NotFoundException(__('Invalid galaxy'));
}
$galaxyId = $temp['Galaxy']['id'];
} elseif (!is_numeric($galaxyId)) {
throw new NotFoundException(__('Invalid galaxy'));
}
$this->loadModel('Attribute');
$distributionLevels = $this->Attribute->distributionLevels;
unset($distributionLevels[5]);