From 9cbd7e945d9a42a1a459b5dd89dac0fafc91c60f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 6 Oct 2014 09:43:50 +0200 Subject: [PATCH] Do not permit the user to give equal names to multiple resources refs #7163 --- library/Icinga/Application/WebSetup.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/Icinga/Application/WebSetup.php b/library/Icinga/Application/WebSetup.php index cce64a462..896d05287 100644 --- a/library/Icinga/Application/WebSetup.php +++ b/library/Icinga/Application/WebSetup.php @@ -113,6 +113,18 @@ class WebSetup extends Wizard implements SetupWizard $page->setResourceConfig($this->getPageData('setup_db_resource')); } elseif ($page->getName() === 'setup_summary') { $page->setSummary($this->getInstaller()->getSummary()); + } elseif ($page->getName() === 'setup_db_resource') { + $ldapData = $this->getPageData('setup_ldap_resource'); + if ($ldapData !== null && $request->getPost('name') === $ldapData['name']) { + $page->addError(t('The given resource name must be unique and is already in use by the LDAP resource')); + } + } elseif ($page->getName() === 'setup_ldap_resource') { + $dbData = $this->getPageData('setup_db_resource'); + if ($dbData !== null && $request->getPost('name') === $dbData['name']) { + $page->addError( + t('The given resource name must be unique and is already in use by the database resource') + ); + } } }