Clone: one more check when cloning templates

This commit is contained in:
Thomas Gelf 2017-10-08 23:43:36 +02:00
parent 4d37ee001f
commit 800633155b
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@
namespace Icinga\Module\Director\Forms; namespace Icinga\Module\Director\Forms;
use Icinga\Exception\IcingaException;
use Icinga\Module\Director\Acl; use Icinga\Module\Director\Acl;
use Icinga\Module\Director\Objects\IcingaHost; use Icinga\Module\Director\Objects\IcingaHost;
use Icinga\Module\Director\Objects\IcingaObject; use Icinga\Module\Director\Objects\IcingaObject;
@ -87,6 +88,12 @@ class IcingaCloneObjectForm extends DirectorForm
$object->getObjectName() $object->getObjectName()
); );
if ($object->isTemplate() && $object->getObjectName() === $newName) {
throw new IcingaException(
$this->translate('Name needs to be changed when cloning a Template')
);
}
$new = $object::fromPlainObject( $new = $object::fromPlainObject(
$object->toPlainObject($resolve), $object->toPlainObject($resolve),
$connection $connection