diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
commit | f66ab8dae2f3d0418759f81a3a64dc9517a62449 (patch) | |
tree | fbff2135e7013f196b891bbde54618eb050e4aaf /application/controllers/SettingsController.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-director-upstream/1.10.2.tar.xz icingaweb2-module-director-upstream/1.10.2.zip |
Adding upstream version 1.10.2.upstream/1.10.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/controllers/SettingsController.php')
-rw-r--r-- | application/controllers/SettingsController.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/application/controllers/SettingsController.php b/application/controllers/SettingsController.php new file mode 100644 index 0000000..c4709e6 --- /dev/null +++ b/application/controllers/SettingsController.php @@ -0,0 +1,48 @@ +<?php + +namespace Icinga\Module\Director\Controllers; + +use Icinga\Module\Director\Forms\KickstartForm; +use Icinga\Module\Director\Forms\SelfServiceSettingsForm; +use Icinga\Module\Director\Settings; +use Icinga\Module\Director\Web\Controller\ActionController; +use ipl\Html\Html; + +class SettingsController extends ActionController +{ + /** + * @throws \Icinga\Exception\Http\HttpNotFoundException + */ + public function indexAction() + { + // Hint: this is for the module configuration tab, legacy code + $this->view->tabs = $this->Module() + ->getConfigTabs() + ->activate('config'); + + $this->view->form = KickstartForm::load() + ->setModuleConfig($this->Config()) + ->handleRequest(); + } + + /** + * @throws \Icinga\Exception\ConfigurationError + * @throws \Icinga\Exception\IcingaException + */ + public function selfServiceAction() + { + $form = SelfServiceSettingsForm::create($this->db(), new Settings($this->db())); + $form->handleRequest(); + + $hint = $this->translate( + 'The Icinga Director Self Service API allows your Hosts to register' + . ' themselves. This allows them to get their Icinga Agent configured,' + . ' installed and upgraded in an automated way.' + ); + + $this->addSingleTab($this->translate('Self Service')) + ->addTitle($this->translate('Self Service API - Global Settings')) + ->content()->add(Html::tag('p', null, $hint)) + ->add($form); + } +} |