19 private array $dashboardList = [];
24 private ?array $allowedDashboardList;
32 if (!isset(self::$manager))
37 return self::$manager;
51 public function getActiveViewList(): array
53 if (!self::checkAccessRights())
61 foreach ($this->getAllowedDashboards() as $dashboard)
63 array_push($viewList, ...$dashboard->getActiveViewList());
68 public function getActiveHandlerList(): array
70 if (!self::checkAccessRights())
78 foreach ($this->getAllowedDashboards() as $dashboard)
81 $viewHandlers = array_map(
static function(ViewRenderable $view) {
82 return $view->getViewHandler();
83 }, $dashboard->getActiveViewList());
85 array_push($handlersList, ...$viewHandlers);
91 public function getDashboardList(): array
93 if (!self::checkAccessRights())
100 foreach ($this->getAllowedDashboards() as $dashboard)
102 $dashboards[] = $dashboard->getDashboard();
108 public function getAnalyticBoardList(): array
110 if (!self::checkAccessRights())
122 foreach ($this->getAllowedDashboards() as $dashboard)
124 $boards[] = $dashboard->getAnalyticBoard();
130 public function getAnalyticBoardBatchList(): array
132 if (!self::checkAccessRights())
144 foreach ($this->getAllowedDashboards() as $dashboard)
146 $boards[] = $dashboard->getAnalyticBoardBatch();
159 array_push($this->dashboardList, ...$dashboard);
162 private function __construct()
164 $this->
addDashboard(...self::getCatalogDashboardList());
170 public function getAllowedDashboards(): array
172 if (isset($this->allowedDashboardList))
174 return $this->allowedDashboardList;
177 $acceptedDashboards = AccessController::getCurrent()->getPermissionValue(ActionDictionary::ACTION_STORE_ANALYTIC_VIEW);
178 if (!$acceptedDashboards)
183 $allAccepted = in_array(PermissionDictionary::VALUE_VARIATION_ALL, $acceptedDashboards,
true);
184 $this->allowedDashboardList = [];
186 foreach ($this->dashboardList as $dashboard)
188 if ($allAccepted || in_array($dashboard->getAccessBoardId(), $acceptedDashboards,
true))
190 $this->allowedDashboardList[] = $dashboard;
194 return $this->allowedDashboardList;
197 private static function checkAccessRights(): bool
200 Loader::includeModule(
'catalog')
201 && AccessController::getCurrent()->check(ActionDictionary::ACTION_CATALOG_READ)
202 && AccessController::getCurrent()->check(ActionDictionary::ACTION_STORE_ANALYTIC_VIEW)