Allow to blacklist access to servicegroups

This commit is contained in:
Johannes Meyer 2021-04-07 12:34:09 +02:00
parent af64a656cb
commit d96f098e34
4 changed files with 21 additions and 6 deletions

View file

@ -19,6 +19,8 @@ class ServicegroupController extends Controller
public function init()
{
$this->assertRouteAccess('servicegroups');
$this->setTitle(t('Service Group'));
$name = $this->params->shiftRequired('name');

View file

@ -18,6 +18,13 @@ use ipl\Web\Url;
class ServicegroupsController extends Controller
{
public function init()
{
parent::init();
$this->assertRouteAccess();
}
public function indexAction()
{
$this->setTitle(t('Service Groups'));

View file

@ -308,10 +308,13 @@ namespace Icinga\Module\Icingadb
]);
}
$section->add(N_('Service Groups'), [
'url' => 'icingadb/servicegroups',
'priority' => 80
]);
if (! array_key_exists('servicegroups', $routeBlacklist)) {
$section->add(N_('Service Groups'), [
'url' => 'icingadb/servicegroups',
'priority' => 80
]);
}
$section->add(N_('History'), [
'url' => 'icingadb/history',
'priority' => 90

View file

@ -209,8 +209,11 @@ class ObjectDetail extends BaseHtmlElement
: new EmptyState(t('Not a member of any host group.'))
);
} else {
$servicegroups = $this->object->servicegroup;
$this->applyRestrictions($servicegroups);
$servicegroups = [];
if ($this->isPermittedRoute('servicegroups')) {
$servicegroups = $this->object->servicegroup;
$this->applyRestrictions($servicegroups);
}
$servicegroupList = new TagList();
foreach ($servicegroups as $servicegroup) {