NavigationConfigForm: Consider a user's config and the share config as one
Actually, we need a more sophisticated solution for this, but I guess this is a proper quickfix to avoid any conflicts when switching between shared and non-shared. refs #5600
This commit is contained in:
parent
4d303e7121
commit
338c0680e0
|
@ -292,7 +292,7 @@ class NavigationConfigForm extends ConfigForm
|
||||||
}
|
}
|
||||||
|
|
||||||
$itemName = $data['name'];
|
$itemName = $data['name'];
|
||||||
if ($config->hasSection($itemName)) {
|
if ($config->hasSection($itemName) || $this->getUserConfig()->hasSection($itemName)) {
|
||||||
throw new IcingaException(
|
throw new IcingaException(
|
||||||
$this->translate('A navigation item with the name "%s" does already exist'),
|
$this->translate('A navigation item with the name "%s" does already exist'),
|
||||||
$itemName
|
$itemName
|
||||||
|
@ -314,6 +314,7 @@ class NavigationConfigForm extends ConfigForm
|
||||||
* @return $this
|
* @return $this
|
||||||
*
|
*
|
||||||
* @throws NotFoundError In case no navigation item with the given name is found
|
* @throws NotFoundError In case no navigation item with the given name is found
|
||||||
|
* @throws IcingaException In case a navigation item with the same name already exists
|
||||||
*/
|
*/
|
||||||
public function edit($name, array $data)
|
public function edit($name, array $data)
|
||||||
{
|
{
|
||||||
|
@ -357,6 +358,13 @@ class NavigationConfigForm extends ConfigForm
|
||||||
if ($data['name'] !== $name) {
|
if ($data['name'] !== $name) {
|
||||||
$oldName = $name;
|
$oldName = $name;
|
||||||
$name = $data['name'];
|
$name = $data['name'];
|
||||||
|
|
||||||
|
if ($config->hasSection($name) || $this->getUserConfig()->hasSection($name)) {
|
||||||
|
throw new IcingaException(
|
||||||
|
$this->translate('A navigation item with the name "%s" does already exist'),
|
||||||
|
$name
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($data['name']);
|
unset($data['name']);
|
||||||
|
|
Loading…
Reference in New Issue