mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-02 08:29:26 -05:00
Use same view script in monitoring and icingadb for Access Denied message
- Host|ServiceController: The extended class `CompatController` has its own tabs. Therefore, set the view script tabs to null to avoid creating tabs twice. - View-scripts: Add a condition to create tabs only when the `monitoring` backend (ido[Host|Service]Controller) is used.
This commit is contained in:
parent
9a91854d4c
commit
d17c4501b2
4 changed files with 14 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ namespace Icinga\Module\Businessprocess\Controllers;
|
|||
use Icinga\Module\Businessprocess\IcingaDbObject;
|
||||
use Icinga\Module\Icingadb\Model\Host;
|
||||
use Icinga\Web\Url;
|
||||
use ipl\Html\HtmlString;
|
||||
use ipl\Stdlib\Filter;
|
||||
use ipl\Web\Compat\CompatController;
|
||||
|
||||
|
|
@ -27,6 +28,10 @@ class HostController extends CompatController
|
|||
$this->redirectNow(Url::fromPath('icingadb/host')->setParams($this->params));
|
||||
}
|
||||
|
||||
$this->getTabs()->disableLegacyExtensions();
|
||||
|
||||
$this->view->host = $hostName;
|
||||
$this->view->tabs = null; // compatController already creates tabs
|
||||
$this->addContent(HtmlString::create($this->view->render('ido-host/show.phtml')));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace Icinga\Module\Businessprocess\Controllers;
|
|||
use Icinga\Module\Businessprocess\IcingaDbObject;
|
||||
use Icinga\Module\Icingadb\Model\Service;
|
||||
use Icinga\Web\Url;
|
||||
use ipl\Html\HtmlString;
|
||||
use ipl\Stdlib\Filter;
|
||||
use ipl\Web\Compat\CompatController;
|
||||
|
||||
|
|
@ -32,7 +33,11 @@ class ServiceController extends CompatController
|
|||
$this->redirectNow(Url::fromPath('icingadb/service')->setParams($this->params));
|
||||
}
|
||||
|
||||
$this->getTabs()->disableLegacyExtensions();
|
||||
|
||||
$this->view->host = $hostName;
|
||||
$this->view->service = $serviceName;
|
||||
$this->view->tabs = null; // compatController already creates tabs
|
||||
$this->addContent(HtmlString::create($this->view->render('ido-service/show.phtml')));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@
|
|||
/** @var \Icinga\Web\Widget\Tabs $tabs */
|
||||
/** @var string $host */
|
||||
?>
|
||||
<?php if ($tabs): ?>
|
||||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content restricted">
|
||||
<h1><?= $this->translate('Access Denied') ?></h1>
|
||||
<p><?= sprintf($this->translate('You are lacking permission to access host "%s".'), $this->escape($host)) ?></p>
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
/** @var string $host */
|
||||
/** @var string $service */
|
||||
?>
|
||||
<?php if ($tabs): ?>
|
||||
<div class="controls">
|
||||
<?= $tabs->showOnlyCloseButton() ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div class="content restricted">
|
||||
<h1><?= $this->escape($this->translate('Access Denied')) ?></h1>
|
||||
<p><?= $this->escape(sprintf($this->translate('You are lacking permission to access service "%s" on host "%s"'), $service, $host)) ?></p>
|
||||
|
|
|
|||
Loading…
Reference in a new issue