File: configuration.php

package info (click to toggle)
icingaweb2-module-nagvis 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 908 kB
  • sloc: php: 1,176; sh: 54; javascript: 42; makefile: 15
file content (49 lines) | stat: -rw-r--r-- 1,121 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php

use Icinga\Application\Config;
use Icinga\Module\Nagvis\RestrictionHelper;
use Icinga\Application\Icinga;

$section = $this->menuSection(N_('Maps'))
    ->setIcon('globe');

$section->add($this->translate('NagVis'))
    ->setUrl('nagvis/show/map');

$prio = 0;

if (Icinga::app()->isCli()) {
    $restriction = null;
} else {
    $restriction = RestrictionHelper::getRegex();
}
foreach (Config::module('nagvis')->getSection('menu') as $name => $caption) {
    if ($restriction !== null && ! preg_match($restriction, $name)) {
        continue;
    }
    $section->add($caption, array(
        'url'           => 'nagvis/show/map',
        'urlParameters' => array('map' => $name),
        'priority'      => ++$prio
    ));
}

$this->providePermission(
    'nagvis/edit',
    $this->translate('Modify NagVis maps')
);

$this->providePermission(
    'nagvis/admin',
    $this->translate('Nagvis administration')
);

$this->providePermission(
    'nagvis/overview',
    $this->translate('NagVis general overview')
);

$this->provideRestriction(
    'nagvis/map/filter',
    $this->translate('Filter NagVis maps')
);