Don't load module dashboards if the authenticated user lacks the module permission

refs #9644
This commit is contained in:
Eric Lippmann 2015-07-23 12:57:23 +02:00
parent e8e01257e6
commit fd77c30838
1 changed files with 7 additions and 7 deletions

View File

@ -70,13 +70,13 @@ class Dashboard extends AbstractWidget
{
$manager = Icinga::app()->getModuleManager();
foreach ($manager->getLoadedModules() as $module) {
/** @var $module \Icinga\Application\Modules\Module */
$this->mergePanes($module->getPaneItems());
if ($this->getUser()->can($manager::MODULE_PERMISSION_NS . $module->getName())) {
$this->mergePanes($module->getPaneItems());
}
}
if ($this->user !== null) {
$this->loadUserDashboards();
}
$this->loadUserDashboards();
return $this;
}
@ -90,11 +90,11 @@ class Dashboard extends AbstractWidget
{
$output = array();
foreach ($this->panes as $pane) {
if ($pane->isUserWidget() === true) {
if ($pane->isUserWidget()) {
$output[$pane->getName()] = $pane->toArray();
}
foreach ($pane->getDashlets() as $dashlet) {
if ($dashlet->isUserWidget() === true) {
if ($dashlet->isUserWidget()) {
$output[$pane->getName() . '.' . $dashlet->getTitle()] = $dashlet->toArray();
}
}