summaryrefslogtreecommitdiffstats
path: root/library/Icinga/Authentication/RolesConfig.php
blob: ac5695f1181c736c7002bcea8e880b17202b5a62 (plain)
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
<?php
/* Icinga Web 2 | (c) 2019 Icinga GmbH | GPLv2+ */

namespace Icinga\Authentication;

use Icinga\Application\Icinga;
use Icinga\Repository\IniRepository;

class RolesConfig extends IniRepository
{
    protected $configs = [
        'roles' => [
            'name'      => 'roles',
            'keyColumn' => 'name'
        ]
    ];

    protected function initializeQueryColumns()
    {
        $columns = [
            'roles' => [
                'parent',
                'name',
                'users',
                'groups',
                'refusals',
                'permissions',
                'unrestricted',
                'application/share/users',
                'application/share/groups'
            ]
        ];

        $moduleManager = Icinga::app()->getModuleManager();
        foreach ($moduleManager->listInstalledModules() as $moduleName) {
            foreach ($moduleManager->getModule($moduleName, false)->getProvidedRestrictions() as $restriction) {
                $columns['roles'][] = $restriction->name;
            }
        }

        return $columns;
    }
}