Skip to content

Commit

Permalink
NavigationConfigForm: Consider a user's config and the share config a…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
Johannes Meyer committed Sep 24, 2015
1 parent 4d303e7 commit 338c068
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions application/forms/Navigation/NavigationConfigForm.php
Expand Up @@ -292,7 +292,7 @@ public function add(array $data)
}

$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
Expand All @@ -313,7 +313,8 @@ public function add(array $data)
*
* @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)
{
Expand Down Expand Up @@ -357,6 +358,13 @@ public function edit($name, array $data)
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']);
Expand Down

0 comments on commit 338c068

Please sign in to comment.