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:
Johannes Meyer 2015-09-24 12:58:11 +02:00
parent 4d303e7121
commit 338c0680e0
1 changed files with 10 additions and 2 deletions

View File

@ -292,7 +292,7 @@ class NavigationConfigForm extends ConfigForm
}
$itemName = $data['name'];
if ($config->hasSection($itemName)) {
if ($config->hasSection($itemName) || $this->getUserConfig()->hasSection($itemName)) {
throw new IcingaException(
$this->translate('A navigation item with the name "%s" does already exist'),
$itemName
@ -313,7 +313,8 @@ class NavigationConfigForm extends ConfigForm
*
* @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)
{
@ -357,6 +358,13 @@ class NavigationConfigForm extends ConfigForm
if ($data['name'] !== $name) {
$oldName = $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']);