Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust ..\Monitoring\Form\Config\SecurityForm to use handleRequest()
refs #5525
- Loading branch information
Johannes Meyer
committed
Sep 3, 2014
1 parent
54a8342
commit 49562e7
Showing
3 changed files
with
73 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
modules/monitoring/application/forms/Config/SecurityConfigForm.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?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'); | ||
$this->setSubmitLabel(t('Save Changes')); | ||
} | ||
|
||
/** | ||
* @see Form::onSuccess() | ||
*/ | ||
public function onSuccess(Request $request) | ||
{ | ||
$this->config->security = $this->getValues(); | ||
|
||
if ($this->save()) { | ||
Notification::success(t('New security configuration has successfully been stored')); | ||
} 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, | ||
'label' => 'Protected Custom Variables', | ||
'description' => 'Comma separated case insensitive list of protected custom variables.' | ||
. ' Use * as a placeholder for zero or more wildcard characters.' | ||
. ' Existance of those custom variables will be shown, but their values will be masked.' | ||
) | ||
); | ||
|
||
return $this; | ||
} | ||
} |
42 changes: 0 additions & 42 deletions
42
modules/monitoring/application/forms/Config/SecurityForm.php
This file was deleted.
Oops, something went wrong.