NavigationController: Show module item types only if accessible by the user

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-21 08:59:36 +02:00
parent 5f998eb56d
commit 5a494b3088
1 changed files with 8 additions and 4 deletions

View File

@ -47,11 +47,15 @@ class NavigationController extends Controller
*/
protected function listItemTypes()
{
$moduleManager = Icinga::app()->getModuleManager();
$types = $this->defaultItemTypes;
foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $module) {
$moduleTypes = $module->getNavigationItems();
if (! empty($moduleTypes)) {
$types = array_merge($types, $moduleTypes);
foreach ($moduleManager->getLoadedModules() as $module) {
if ($this->hasPermission($moduleManager::MODULE_PERMISSION_NS . $module->getName())) {
$moduleTypes = $module->getNavigationItems();
if (! empty($moduleTypes)) {
$types = array_merge($types, $moduleTypes);
}
}
}