From 6b10cdc3f78372113ba5cf8d91c2377f7bccb46a Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 6 Jul 2017 15:10:00 +0200 Subject: [PATCH] IcingaHostForm: allow to set api_key for templates refs #486 --- application/forms/IcingaHostForm.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/application/forms/IcingaHostForm.php b/application/forms/IcingaHostForm.php index 66b7f1c2..dc830d9b 100644 --- a/application/forms/IcingaHostForm.php +++ b/application/forms/IcingaHostForm.php @@ -64,6 +64,17 @@ class IcingaHostForm extends DirectorObjectForm 'class' => 'autosubmit', )); + if ($this->isTemplate() && $this->object()->getShortTableName() === 'host') { + $this->addElement('text', 'api_key', array( + 'label' => $this->translate('API key'), + 'description' => $this->translate( + 'This key (16-32 characters long) allows one to deploy new' + . ' hosts for this template through the REST API without' + . ' authentication.' + ), + )); + } + if ($this->getSentOrResolvedObjectValue('has_agent') === 'y') { $this->addBoolean('master_should_connect', array( 'label' => $this->translate('Establish connection'), @@ -106,6 +117,7 @@ class IcingaHostForm extends DirectorObjectForm 'master_should_connect', 'accept_config', 'command_endpoint_id', + 'api_key', ); $this->addDisplayGroup($elements, 'clustering', array( 'decorators' => array(