-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfiguration.php
61 lines (43 loc) · 1.71 KB
/
configuration.php
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
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/** @var \Icinga\Application\Modules\Module $this */
use Icinga\Application\Icinga;
use Icinga\Authentication\Auth;
use Icinga\Data\Filter\FilterMatch;
use Icinga\Module\Teamdashboards\MappingIniRepository;
$section = $this->menuSection(N_('Teamdashboards'), [
'url' => 'navigation/dashboard?name=teamdashboards',
'icon' => 'dashboard',
'priority' => 15
]);
$this->providePermission('teamdashboards/mapping', $this->translate('allow access to mapping'));
$section->add(N_('Mapping'))
->setUrl('teamdashboards/mapping')
->setPermission('teamdashboards/mapping')
->setPriority(30);
$this->provideConfigTab('config/mapping', array(
'title' => $this->translate('Configuration'),
'label' => $this->translate('Configuration'),
'url' => 'mapping'
));
$auth = Auth::getInstance();
if ($auth->isAuthenticated() && !Icinga::app()->isCli()) {
$mappings = (new MappingIniRepository())->select()->fetchAll();
foreach ($mappings as $mapping) {
$permission = 'teamdashboards/mapping/' . $mapping->name;
$this->providePermission($permission, $this->translate('allow access to mapping') . " " . $mapping->name);
if($mapping->enabled ==1){
if($auth->hasPermission($permission)){
$displayname = $mapping->name;
if(isset($mapping->alias) && !empty($mapping->alias)){
$displayname = $mapping->alias;
}
$section->add($displayname, array(
'url' => 'teamdashboards/team-dashboard',
'urlParameters' => array('user' => $mapping->name),
'priority' => $mapping->priority,
));
}
}
}
}
?>