mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
Merge branch 'feature/inspect-permission-11764'
This commit is contained in:
commit
f43481a13e
@ -8,6 +8,7 @@ class EndpointController extends ObjectController
|
|||||||
{
|
{
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
$this->assertPermission('director/inspect');
|
||||||
parent::init();
|
parent::init();
|
||||||
if ($this->object && $this->object->hasApiUser()) {
|
if ($this->object && $this->object->hasApiUser()) {
|
||||||
$params['endpoint'] = $this->object->object_name;
|
$params['endpoint'] = $this->object->object_name;
|
||||||
|
@ -6,6 +6,12 @@ use Icinga\Module\Director\Web\Controller\ActionController;
|
|||||||
|
|
||||||
class InspectController extends ActionController
|
class InspectController extends ActionController
|
||||||
{
|
{
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$this->assertPermission('director/inspect');
|
||||||
|
parent::init();
|
||||||
|
}
|
||||||
|
|
||||||
public function typesAction()
|
public function typesAction()
|
||||||
{
|
{
|
||||||
$api = $this->api();
|
$api = $this->api();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
$this->providePermission('director/api', $this->translate('Allow to access the director API'));
|
$this->providePermission('director/api', $this->translate('Allow to access the director API'));
|
||||||
$this->providePermission('director/hosts/read', $this->translate('Allow to configure hosts'));
|
$this->providePermission('director/hosts/read', $this->translate('Allow to configure hosts'));
|
||||||
$this->providePermission('director/hosts/write', $this->translate('Allow to configure hosts'));
|
$this->providePermission('director/hosts/write', $this->translate('Allow to configure hosts'));
|
||||||
|
$this->providePermission('director/inspect', $this->translate('Allow to inspect objects through the Icinga 2 API'));
|
||||||
$this->providePermission('director/templates/read', $this->translate('Allow to see template details'));
|
$this->providePermission('director/templates/read', $this->translate('Allow to see template details'));
|
||||||
$this->providePermission('director/templates/write', $this->translate('Allow to configure templates'));
|
$this->providePermission('director/templates/write', $this->translate('Allow to configure templates'));
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ use Exception;
|
|||||||
use Icinga\Application\Config;
|
use Icinga\Application\Config;
|
||||||
use Icinga\Module\Director\Db;
|
use Icinga\Module\Director\Db;
|
||||||
use Icinga\Module\Director\Objects\IcingaHost;
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
|
use Icinga\Module\Director\Util;
|
||||||
use Icinga\Module\Monitoring\Hook\HostActionsHook;
|
use Icinga\Module\Monitoring\Hook\HostActionsHook;
|
||||||
use Icinga\Module\Monitoring\Object\Host;
|
use Icinga\Module\Monitoring\Object\Host;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
@ -29,16 +30,21 @@ class HostActions extends HostActionsHook
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IcingaHost::exists($host->host_name, $db)) {
|
if (IcingaHost::exists($host->host_name, $db)) {
|
||||||
return array(
|
$actions = array(
|
||||||
'Modify' => Url::fromPath(
|
'Modify' => Url::fromPath(
|
||||||
'director/host/edit',
|
'director/host/edit',
|
||||||
array('name' => $host->host_name)
|
array('name' => $host->host_name)
|
||||||
),
|
|
||||||
'Inspect' => Url::fromPath(
|
|
||||||
'director/inspect/object',
|
|
||||||
array('type' => 'host', 'plural' => 'hosts', 'name' => $host->host_name)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (Util::hasPermission('director/inspect')) {
|
||||||
|
$actions['Inspect'] = Url::fromPath(
|
||||||
|
'director/inspect/object',
|
||||||
|
array('type' => 'host', 'plural' => 'hosts', 'name' => $host->host_name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $actions;
|
||||||
} else {
|
} else {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ use Exception;
|
|||||||
use Icinga\Application\Config;
|
use Icinga\Application\Config;
|
||||||
use Icinga\Module\Director\Db;
|
use Icinga\Module\Director\Db;
|
||||||
use Icinga\Module\Director\Objects\IcingaHost;
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
|
use Icinga\Module\Director\Util;
|
||||||
use Icinga\Module\Monitoring\Hook\ServiceActionsHook;
|
use Icinga\Module\Monitoring\Hook\ServiceActionsHook;
|
||||||
use Icinga\Module\Monitoring\Object\Service;
|
use Icinga\Module\Monitoring\Object\Service;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
@ -23,6 +24,10 @@ class ServiceActions extends ServiceActionsHook
|
|||||||
|
|
||||||
protected function getThem(Service $service)
|
protected function getThem(Service $service)
|
||||||
{
|
{
|
||||||
|
if (! Util::hasPermission('director/inspect')) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
$db = $this->db();
|
$db = $this->db();
|
||||||
if (! $db) {
|
if (! $db) {
|
||||||
return array();
|
return array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user