icingadb-web/application/controllers/UsersController.php

46 lines
1.1 KiB
PHP
Raw Normal View History

2019-10-24 07:59:20 -04:00
<?php
2019-11-04 19:07:30 -05:00
namespace Icinga\Module\Icingadb\Controllers;
2019-10-24 07:59:20 -04:00
2019-11-04 19:07:30 -05:00
use Icinga\Module\Icingadb\Model\User;
use Icinga\Module\Icingadb\Web\Controller;
use Icinga\Module\Icingadb\Widget\ItemList\UserList;
use Icinga\Security\SecurityException;
2019-10-24 07:59:20 -04:00
class UsersController extends Controller
{
public function init()
{
parent::init();
if (! $this->hasPermission('*') && $this->hasPermission('no-monitoring/contacts')) {
throw new SecurityException('No permission for %s', 'monitoring/contacts');
}
}
2019-10-24 07:59:20 -04:00
public function indexAction()
{
$this->setTitle($this->translate('Users'));
$db = $this->getDb();
$users = User::on($db);
$limitControl = $this->createLimitControl();
$paginationControl = $this->createPaginationControl($users);
$filterControl = $this->createFilterControl($users);
$this->filter($users);
yield $this->export($users);
$this->addControl($paginationControl);
$this->addControl($limitControl);
$this->addControl($filterControl);
$this->addContent(new UserList($users));
$this->setAutorefreshInterval(10);
2019-10-24 07:59:20 -04:00
}
}