Clone: one more check when cloning templates
This commit is contained in:
parent
4d37ee001f
commit
800633155b
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Director\Forms;
|
||||
|
||||
use Icinga\Exception\IcingaException;
|
||||
use Icinga\Module\Director\Acl;
|
||||
use Icinga\Module\Director\Objects\IcingaHost;
|
||||
use Icinga\Module\Director\Objects\IcingaObject;
|
||||
|
@ -87,6 +88,12 @@ class IcingaCloneObjectForm extends DirectorForm
|
|||
$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(
|
||||
$object->toPlainObject($resolve),
|
||||
$connection
|
||||
|
|
Loading…
Reference in New Issue