RoleForm: Use hook `ConfigFormEventsHook`
This commit is contained in:
parent
dc8981f209
commit
d9044203e7
|
@ -3,12 +3,14 @@
|
||||||
|
|
||||||
namespace Icinga\Forms\Security;
|
namespace Icinga\Forms\Security;
|
||||||
|
|
||||||
|
use Icinga\Application\Hook\ConfigFormEventsHook;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Application\Modules\Manager;
|
use Icinga\Application\Modules\Manager;
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Forms\ConfigForm;
|
use Icinga\Forms\ConfigForm;
|
||||||
use Icinga\Forms\RepositoryForm;
|
use Icinga\Forms\RepositoryForm;
|
||||||
use Icinga\Util\StringHelper;
|
use Icinga\Util\StringHelper;
|
||||||
|
use Icinga\Web\Notification;
|
||||||
use Zend_Form_Element;
|
use Zend_Form_Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -384,4 +386,33 @@ class RoleForm extends RepositoryForm
|
||||||
return strnatcmp($a, $b);
|
return strnatcmp($a, $b);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isValid($formData)
|
||||||
|
{
|
||||||
|
$valid = parent::isValid($formData);
|
||||||
|
|
||||||
|
if ($valid && ConfigFormEventsHook::runIsValid($this) === false) {
|
||||||
|
foreach (ConfigFormEventsHook::getLastErrors() as $msg) {
|
||||||
|
$this->error($msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
$valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onSuccess()
|
||||||
|
{
|
||||||
|
if (parent::onSuccess() === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ConfigFormEventsHook::runOnSuccess($this) === false) {
|
||||||
|
Notification::error($this->translate(
|
||||||
|
'Configuration successfully stored. Though, one or more module hooks failed to run.'
|
||||||
|
. ' See logs for details'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue