2019-11-05 03:17:11 -05:00
|
|
|
<?php
|
|
|
|
|
|
2020-03-13 03:38:01 -04:00
|
|
|
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
|
|
|
|
|
2019-11-05 03:17:11 -05:00
|
|
|
namespace Icinga\Module\Icingadb\Controllers;
|
|
|
|
|
|
|
|
|
|
use Icinga\Exception\NotFoundError;
|
|
|
|
|
use Icinga\Module\Icingadb\Model\Usergroup;
|
|
|
|
|
use Icinga\Module\Icingadb\Web\Controller;
|
2025-03-20 04:55:30 -04:00
|
|
|
use Icinga\Module\Icingadb\Widget\Detail\ObjectHeader;
|
2021-08-06 07:17:44 -04:00
|
|
|
use Icinga\Module\Icingadb\Widget\Detail\UsergroupDetail;
|
2022-03-29 08:39:50 -04:00
|
|
|
use ipl\Stdlib\Filter;
|
2019-11-05 03:17:11 -05:00
|
|
|
|
2025-04-04 10:05:56 -04:00
|
|
|
class ContactgroupController extends Controller
|
2019-11-05 03:17:11 -05:00
|
|
|
{
|
|
|
|
|
/** @var Usergroup The usergroup object */
|
|
|
|
|
protected $usergroup;
|
|
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
|
{
|
2025-04-04 09:53:41 -04:00
|
|
|
$this->assertRouteAccess('contactgroups');
|
2019-12-10 04:46:10 -05:00
|
|
|
|
2025-04-04 10:05:56 -04:00
|
|
|
$this->addTitleTab(t('Contact Group'));
|
2019-11-05 03:17:11 -05:00
|
|
|
|
2021-08-31 06:34:18 -04:00
|
|
|
$name = $this->params->getRequired('name');
|
2019-11-05 03:17:11 -05:00
|
|
|
|
|
|
|
|
$query = Usergroup::on($this->getDb());
|
2022-03-29 08:39:50 -04:00
|
|
|
$query->filter(Filter::equal('usergroup.name', $name));
|
2019-11-05 03:17:11 -05:00
|
|
|
|
2021-01-28 06:38:03 -05:00
|
|
|
$this->applyRestrictions($query);
|
2019-11-22 10:01:27 -05:00
|
|
|
|
2019-11-05 03:17:11 -05:00
|
|
|
$usergroup = $query->first();
|
|
|
|
|
if ($usergroup === null) {
|
2025-04-04 10:05:56 -04:00
|
|
|
throw new NotFoundError(t('Contact group not found'));
|
2019-11-05 03:17:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->usergroup = $usergroup;
|
2022-03-16 11:06:00 -04:00
|
|
|
$this->setTitle($usergroup->display_name);
|
2019-11-05 03:17:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
|
{
|
2025-03-20 04:55:30 -04:00
|
|
|
$this->addControl(new ObjectHeader($this->usergroup));
|
2021-08-06 07:17:44 -04:00
|
|
|
$this->addContent(new UsergroupDetail($this->usergroup));
|
2019-12-11 02:59:30 -05:00
|
|
|
|
|
|
|
|
$this->setAutorefreshInterval(10);
|
2019-11-05 03:17:11 -05:00
|
|
|
}
|
|
|
|
|
}
|