mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-08-20 01:08:12 +02:00
38 lines
944 B
PHP
38 lines
944 B
PHP
<?php
|
|
|
|
namespace Icinga\Module\Director\Forms;
|
|
|
|
use Icinga\Module\Director\Data\Db\DbObjectStore;
|
|
use Icinga\Module\Director\Db;
|
|
use Icinga\Module\Director\Db\Branch\Branch;
|
|
use Icinga\Module\Director\Objects\IcingaObject;
|
|
use Icinga\Web\Session;
|
|
use ipl\Web\Common\CsrfCounterMeasure;
|
|
use ipl\Web\Compat\CompatForm;
|
|
|
|
class IcingaDeleteUsergroupForm extends CompatForm
|
|
{
|
|
use CsrfCounterMeasure;
|
|
|
|
public function __construct(
|
|
protected IcingaObject $object,
|
|
protected Db $db,
|
|
protected ?Branch $branch = null
|
|
) {
|
|
}
|
|
|
|
protected function assemble(): void
|
|
{
|
|
$this->addElement($this->createCsrfCounterMeasure(Session::getSession()->getId()));
|
|
|
|
$this->addElement('submit', 'submit', [
|
|
'label' => $this->translate('Delete')
|
|
]);
|
|
}
|
|
|
|
protected function onSuccess(): void
|
|
{
|
|
(new DbObjectStore($this->db, $this->branch))->delete($this->object);
|
|
}
|
|
}
|