mirror of https://github.com/MISP/MISP
Removed SG options if no SGs exist from attribute creation/edit
parent
43905247d2
commit
7cc3a9a6d9
|
@ -257,7 +257,6 @@ class AttributesController extends AppController {
|
|||
$events = $this->Event->findById($eventId);
|
||||
$this->set('event_id', $events['Event']['id']);
|
||||
// combobox for distribution
|
||||
$this->set('distributionLevels', $this->Attribute->distributionLevels);
|
||||
$this->set('currentDist', $events['Event']['distribution']); // TODO default distribution
|
||||
// tooltip for distribution
|
||||
$this->set('distributionDescriptions', $this->Attribute->distributionDescriptions);
|
||||
|
@ -266,6 +265,10 @@ class AttributesController extends AppController {
|
|||
$sgs = $this->SharingGroup->fetchAllAuthorised($this->Auth->user(), 'name', 1);
|
||||
$this->set('sharingGroups', $sgs);
|
||||
|
||||
$distributionLevels = $this->Event->distributionLevels;
|
||||
if (empty($sgs)) unset ($distributionLevels[4]);
|
||||
$this->set('distributionLevels', $distributionLevels);
|
||||
|
||||
$this->set('attrDescriptions', $this->Attribute->fieldDescriptions);
|
||||
$this->set('typeDefinitions', $this->Attribute->typeDefinitions);
|
||||
$this->set('categoryDefinitions', $this->Attribute->categoryDefinitions);
|
||||
|
@ -774,8 +777,6 @@ class AttributesController extends AppController {
|
|||
$categories = $this->_arrayToValuesIndexArray($categories);
|
||||
$this->set('categories', $categories);
|
||||
$this->set('currentDist', $this->Event->data['Event']['distribution']);
|
||||
// combobox for distribution
|
||||
$this->set('distributionLevels', $this->Attribute->distributionLevels);
|
||||
// tooltip for distribution
|
||||
$this->set('distributionDescriptions', $this->Attribute->distributionDescriptions);
|
||||
|
||||
|
@ -783,6 +784,10 @@ class AttributesController extends AppController {
|
|||
$sgs = $this->SharingGroup->fetchAllAuthorised($this->Auth->user(), 'name', 1);
|
||||
$this->set('sharingGroups', $sgs);
|
||||
|
||||
$distributionLevels = $this->Event->distributionLevels;
|
||||
if (empty($sgs)) unset ($distributionLevels[4]);
|
||||
$this->set('distributionLevels', $distributionLevels);
|
||||
|
||||
$this->set('attrDescriptions', $this->Attribute->fieldDescriptions);
|
||||
$this->set('typeDefinitions', $this->Attribute->typeDefinitions);
|
||||
$this->set('categoryDefinitions', $this->Attribute->categoryDefinitions);
|
||||
|
|
|
@ -36,10 +36,12 @@
|
|||
?>
|
||||
<div id="SGContainer" style="display:none;">
|
||||
<?php
|
||||
if (!empty($sharingGroups)) {
|
||||
echo $this->Form->input('sharing_group_id', array(
|
||||
'options' => array($sharingGroups),
|
||||
'label' => 'Sharing Group',
|
||||
));
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
?>
|
||||
<div id="SGContainer" style="display:none;">
|
||||
<?php
|
||||
echo $this->Form->input('sharing_group_id', array(
|
||||
'options' => array($sharingGroups),
|
||||
'label' => 'Sharing Group',
|
||||
));
|
||||
if (!empty($sharingGroups)) {
|
||||
echo $this->Form->input('sharing_group_id', array(
|
||||
'options' => array($sharingGroups),
|
||||
'label' => 'Sharing Group',
|
||||
));
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue