diff --git a/application/controllers/HostController.php b/application/controllers/HostController.php new file mode 100644 index 0000000..134ab5b --- /dev/null +++ b/application/controllers/HostController.php @@ -0,0 +1,24 @@ +params->getRequired('host'); + + $query = $this->backend->select() + ->from('hoststatus', array('host_name')) + ->where('host_name', $host); + + if ($this->applyRestriction('monitoring/filter/objects', $query)->fetchRow() !== false) { + $this->redirectNow(Url::fromPath('monitoring/host/show')->setParams($this->params)); + } + + $this->view->host = $host; + } +} diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php new file mode 100644 index 0000000..17bb474 --- /dev/null +++ b/application/controllers/ServiceController.php @@ -0,0 +1,27 @@ +params->getRequired('host'); + $service = $this->params->getRequired('service'); + + $query = $this->backend->select() + ->from('servicestatus', array('service_description')) + ->where('host_name', $host) + ->where('service_description', $service); + + if ($this->applyRestriction('monitoring/filter/objects', $query)->fetchRow() !== false) { + $this->redirectNow(Url::fromPath('monitoring/service/show')->setParams($this->params)); + } + + $this->view->host = $host; + $this->view->service = $service; + } +} diff --git a/application/views/scripts/host/show.phtml b/application/views/scripts/host/show.phtml new file mode 100644 index 0000000..413baf2 --- /dev/null +++ b/application/views/scripts/host/show.phtml @@ -0,0 +1,13 @@ + +
+ showOnlyCloseButton() ?> +
+
+

translate('Access Denied') ?>

+

translate('You are lacking permission to access host "%s".'), $this->escape($host)) ?>

+ icon('cancel') ?>translate('Hide this message') ?> +
diff --git a/application/views/scripts/service/show.phtml b/application/views/scripts/service/show.phtml new file mode 100644 index 0000000..205b3f7 --- /dev/null +++ b/application/views/scripts/service/show.phtml @@ -0,0 +1,14 @@ + +
+ showOnlyCloseButton() ?> +
+
+

escape($this->translate('Access Denied')) ?>

+

escape(sprintf($this->translate('You are lacking permission to access service "%s" on host "%s"'), $service, $host)) ?>

+ icon('cancel') ?>translate('Hide this message') ?> +
diff --git a/library/Businessprocess/HostNode.php b/library/Businessprocess/HostNode.php index d700a5b..130cebe 100644 --- a/library/Businessprocess/HostNode.php +++ b/library/Businessprocess/HostNode.php @@ -64,7 +64,7 @@ class HostNode extends MonitoredNode $params['backend'] = $this->bp->getBackendName(); } - return Url::fromPath('monitoring/host/show', $params); + return Url::fromPath('businessprocess/host/show', $params); } public function getLink() diff --git a/library/Businessprocess/ServiceNode.php b/library/Businessprocess/ServiceNode.php index b827835..517b059 100644 --- a/library/Businessprocess/ServiceNode.php +++ b/library/Businessprocess/ServiceNode.php @@ -51,6 +51,6 @@ class ServiceNode extends MonitoredNode $params['backend'] = $this->bp->getBackendName(); } - return Url::fromPath('monitoring/service/show', $params); + return Url::fromPath('businessprocess/service/show', $params); } } diff --git a/public/css/module.less b/public/css/module.less index 68a58b3..5e18cbf 100644 --- a/public/css/module.less +++ b/public/css/module.less @@ -611,6 +611,16 @@ td > a > .badges { /** END of tiles **/ +.content.restricted { + h1 { + font-size: 2em; + } + + p > a { + margin-left: 1em; + } +} + /** BEGIN breadcrumb **/ .breadcrumb { diff --git a/test/php/library/Businessprocess/HostNodeTest.php b/test/php/library/Businessprocess/HostNodeTest.php index 72852dc..9146bee 100644 --- a/test/php/library/Businessprocess/HostNodeTest.php +++ b/test/php/library/Businessprocess/HostNodeTest.php @@ -35,7 +35,7 @@ class HostNodeTest extends BaseTestCase public function testRendersCorrectLink() { $this->assertEquals( - '' + '' . 'localhost', $this->localhost()->getLink()->render() ); diff --git a/test/php/library/Businessprocess/ServiceNodeTest.php b/test/php/library/Businessprocess/ServiceNodeTest.php index 152c256..c5fd719 100644 --- a/test/php/library/Businessprocess/ServiceNodeTest.php +++ b/test/php/library/Businessprocess/ServiceNodeTest.php @@ -35,7 +35,7 @@ class ServiceNodeTest extends BaseTestCase public function testRendersCorrectLink() { $this->assertEquals( - '' + '' . 'localhost: ping <> pong', $this->pingOnLocalhost()->getLink()->render() );