/**
  * Constructor.
  */
 public function __construct(HomeTab $homeTab, WidgetHomeTabConfig $whtc, WidgetDisplayConfig $wdc = null)
 {
     $widgetInstance = $whtc->getWidgetInstance();
     $widget = $widgetInstance->getWidget();
     $details = [];
     $details['tabId'] = $homeTab->getId();
     $details['tabName'] = $homeTab->getName();
     $details['tabType'] = $homeTab->getType();
     $details['tabIcon'] = $homeTab->getIcon();
     $details['widgetId'] = $widget->getId();
     $details['widgetName'] = $widget->getName();
     $details['widgetIsConfigurable'] = $widget->isConfigurable();
     $details['widgetIsExportable'] = $widget->isExportable();
     $details['widgetIsDisplayableInWorkspace'] = $widget->isDisplayableInWorkspace();
     $details['widgetIsDisplayableInDesktop'] = $widget->isDisplayableInDesktop();
     $details['id'] = $widgetInstance->getId();
     $details['name'] = $widgetInstance->getName();
     $details['icon'] = $widgetInstance->getIcon();
     $details['isAdmin'] = $widgetInstance->isAdmin();
     $details['isDesktop'] = $widgetInstance->isDesktop();
     $details['widgetHomeTabConfigId'] = $whtc->getId();
     $details['order'] = $whtc->getWidgetOrder();
     $details['type'] = $whtc->getType();
     $details['visible'] = $whtc->isVisible();
     $details['locked'] = $whtc->isLocked();
     if (!is_null($wdc)) {
         $details['widgetDisplayConfigId'] = $wdc->getId();
         $details['row'] = $wdc->getRow();
         $details['column'] = $wdc->getColumn();
         $details['width'] = $wdc->getWidth();
         $details['height'] = $wdc->getHeight();
         $details['color'] = $wdc->getColor();
     }
     parent::__construct(self::ACTION, $details);
 }
 private function checkAdminAccessForWidgetHomeTabConfig(WidgetHomeTabConfig $whtc)
 {
     if ($whtc->getType() !== 'admin' || !is_null($whtc->getUser()) || !is_null($whtc->getWorkspace())) {
         throw new AccessDeniedException();
     }
 }
Example #3
0
 private function checkWorkspaceAccessForWidgetHomeTabConfig(WidgetHomeTabConfig $widgetHomeTabConfig, Workspace $workspace)
 {
     $widgetHomeTabConfigWorkspace = $widgetHomeTabConfig->getWorkspace();
     if ($widgetHomeTabConfig->getType() !== 'workspace' || is_null($widgetHomeTabConfigWorkspace) || $widgetHomeTabConfigWorkspace->getId() !== $workspace->getId()) {
         throw new AccessDeniedException();
     }
 }