2014-09-03 15:08:37 +02:00
|
|
|
<?php
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
|
|
|
|
namespace Icinga\Module\Monitoring\Form\Config;
|
|
|
|
|
|
|
|
use Icinga\Web\Request;
|
|
|
|
use Icinga\Web\Notification;
|
|
|
|
use Icinga\Form\ConfigForm;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Form for modifying security relevant settings
|
|
|
|
*/
|
|
|
|
class SecurityConfigForm extends ConfigForm
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Initialize this form
|
|
|
|
*/
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$this->setName('form_config_monitoring_security');
|
2014-10-21 17:22:16 +02:00
|
|
|
$this->setSubmitLabel(mt('monitoring', 'Save Changes'));
|
2014-09-03 15:08:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see Form::onSuccess()
|
|
|
|
*/
|
|
|
|
public function onSuccess(Request $request)
|
|
|
|
{
|
|
|
|
$this->config->security = $this->getValues();
|
|
|
|
|
|
|
|
if ($this->save()) {
|
2014-10-21 17:22:16 +02:00
|
|
|
Notification::success(mt('monitoring', 'New security configuration has successfully been stored'));
|
2014-09-03 15:08:37 +02:00
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see Form::onRequest()
|
|
|
|
*/
|
|
|
|
public function onRequest(Request $request)
|
|
|
|
{
|
|
|
|
if (isset($this->config->security)) {
|
|
|
|
$this->populate($this->config->security->toArray());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see Form::createElements()
|
|
|
|
*/
|
|
|
|
public function createElements(array $formData)
|
|
|
|
{
|
|
|
|
$this->addElement(
|
|
|
|
'text',
|
|
|
|
'protected_customvars',
|
|
|
|
array(
|
|
|
|
'required' => true,
|
2014-10-21 17:22:16 +02:00
|
|
|
'label' => mt('monitoring', 'Protected Custom Variables'),
|
|
|
|
'description' => mt('monitoring',
|
2014-09-29 15:20:19 +02:00
|
|
|
'Comma separated case insensitive list of protected custom variables.'
|
2014-09-03 15:08:37 +02:00
|
|
|
. ' Use * as a placeholder for zero or more wildcard characters.'
|
|
|
|
. ' Existance of those custom variables will be shown, but their values will be masked.'
|
2014-09-29 15:20:19 +02:00
|
|
|
)
|
2014-09-03 15:08:37 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|