mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Apply monitoring restrictions in all controllers
This commit is contained in:
parent
ccd0709fba
commit
4875c06bb9
9 changed files with 25 additions and 0 deletions
|
|
@ -33,6 +33,8 @@ class CommentController extends Controller
|
|||
$query->getSelectBase()
|
||||
->where(['comment.name = ?' => $name]);
|
||||
|
||||
$this->applyMonitoringRestriction($query);
|
||||
|
||||
$comment = $query->first();
|
||||
if ($comment === null) {
|
||||
throw new NotFoundError($this->translate('Comment not found'));
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ class DowntimeController extends Controller
|
|||
$query->getSelectBase()
|
||||
->where(['name = ?' => $name]);
|
||||
|
||||
$this->applyMonitoringRestriction($query);
|
||||
|
||||
$downtime = $query->first();
|
||||
if ($downtime === null) {
|
||||
throw new NotFoundError($this->translate('Downtime not found'));
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ class HostController extends Controller
|
|||
$query->getSelectBase()
|
||||
->where(['name = ?' => $name]);
|
||||
|
||||
$this->applyMonitoringRestriction($query);
|
||||
|
||||
/** @var Host $host */
|
||||
$host = $query->first();
|
||||
if ($host === null) {
|
||||
|
|
@ -149,6 +151,8 @@ class HostController extends Controller
|
|||
->getSelectBase()
|
||||
->where(['service_host.id = ?' => $this->host->id]);
|
||||
|
||||
$this->applyMonitoringRestriction($services);
|
||||
|
||||
$limitControl = $this->createLimitControl();
|
||||
$paginationControl = $this->createPaginationControl($services);
|
||||
$viewModeSwitcher = $this->createViewModeSwitcher();
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ class HostgroupController extends Controller
|
|||
$query
|
||||
);
|
||||
|
||||
$this->applyMonitoringRestriction($query);
|
||||
|
||||
$hostgroup = $query->first();
|
||||
if ($hostgroup === null) {
|
||||
throw new NotFoundError($this->translate('Host group not found'));
|
||||
|
|
@ -36,6 +38,7 @@ class HostgroupController extends Controller
|
|||
|
||||
$this->hostgroup = $hostgroup;
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->addControl((new HostgroupList([$this->hostgroup])));
|
||||
|
|
@ -49,6 +52,8 @@ class HostgroupController extends Controller
|
|||
$hosts
|
||||
);
|
||||
|
||||
$this->applyMonitoringRestriction($hosts);
|
||||
|
||||
$limitControl = $this->createLimitControl();
|
||||
$paginationControl = $this->createPaginationControl($hosts);
|
||||
$viewModeSwitcher = $this->createViewModeSwitcher();
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ class ServiceController extends Controller
|
|||
->where(['service.name = ?' => $name])
|
||||
->where(['service_host.name = ?' => $hostName]);
|
||||
|
||||
$this->applyMonitoringRestriction($query);
|
||||
|
||||
/** @var Service $service */
|
||||
$service = $query->first();
|
||||
if ($service === null) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ class ServicegroupController extends Controller
|
|||
$query
|
||||
);
|
||||
|
||||
$this->applyMonitoringRestriction($query);
|
||||
|
||||
$servicegroup = $query->first();
|
||||
if ($servicegroup === null) {
|
||||
throw new NotFoundError($this->translate('Service group not found'));
|
||||
|
|
@ -53,6 +55,8 @@ class ServicegroupController extends Controller
|
|||
$services
|
||||
);
|
||||
|
||||
$this->applyMonitoringRestriction($services);
|
||||
|
||||
$limitControl = $this->createLimitControl();
|
||||
$paginationControl = $this->createPaginationControl($services);
|
||||
$viewModeSwitcher = $this->createViewModeSwitcher();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ class UserController extends Controller
|
|||
$query->getSelectBase()
|
||||
->where(['name = ?' => $name]);
|
||||
|
||||
$this->applyMonitoringRestriction($query);
|
||||
|
||||
$user = $query->first();
|
||||
if ($user === null) {
|
||||
throw new NotFoundError($this->translate('User not found'));
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ class UsergroupController extends Controller
|
|||
$query->getSelectBase()
|
||||
->where(['name = ?' => $name]);
|
||||
|
||||
$this->applyMonitoringRestriction($query);
|
||||
|
||||
$usergroup = $query->first();
|
||||
if ($usergroup === null) {
|
||||
throw new NotFoundError($this->translate('User group not found'));
|
||||
|
|
|
|||
|
|
@ -202,6 +202,8 @@ class Controller extends CompatController
|
|||
|
||||
public function filter(Query $query)
|
||||
{
|
||||
$this->applyMonitoringRestriction($query);
|
||||
|
||||
FilterProcessor::apply(
|
||||
Filter::fromQueryString((string) $this->params),
|
||||
$query
|
||||
|
|
|
|||
Loading…
Reference in a new issue