IcingaCloneObjectForm: reset api key when cloning

This commit is contained in:
Thomas Gelf 2017-08-18 13:40:46 +02:00
parent 7780c0b11b
commit 5ee215df27
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@
namespace Icinga\Module\Director\Forms;
use Icinga\Module\Director\Objects\IcingaHost;
use Icinga\Module\Director\Objects\IcingaObject;
use Icinga\Module\Director\Web\Form\DirectorForm;
@ -53,6 +54,10 @@ class IcingaCloneObjectForm extends DirectorForm
$object->getConnection()
)->set('object_name', $newname);
if ($new instanceof IcingaHost) {
$new->set('api_key', null);
}
if ($new->store()) {
$this->setSuccessUrl(
'director/' . strtolower($object->getShortTableName()),