/** * Constructor. */ public function __construct(HomeTabConfig $htc) { $user = $htc->getUser(); $workspace = $htc->getWorkspace(); $homeTab = $htc->getHomeTab(); $details = []; $details['tabId'] = $homeTab->getId(); $details['tabName'] = $homeTab->getName(); $details['tabType'] = $homeTab->getType(); $details['tabIcon'] = $homeTab->getIcon(); $details['configId'] = $htc->getId(); $details['type'] = $htc->getType(); $details['locked'] = $htc->isLocked(); $details['visible'] = $htc->isVisible(); $details['tabOrder'] = $htc->getTabOrder(); $details['details'] = $htc->getDetails(); $details['workspaceId'] = $workspace->getId(); $details['workspaceCode'] = $workspace->getCode(); $details['workspaceName'] = $workspace->getName(); $details['workspaceGuid'] = $workspace->getGuid(); parent::__construct(self::ACTION, $details, $user, null, null, null, $workspace); }
private function checkHomeTabConfig(User $authenticatedUser, HomeTabConfig $htc, $homeTabType) { $user = $htc->getUser(); $type = $htc->getType(); if ($type !== $homeTabType || $authenticatedUser !== $user) { throw new AccessDeniedException(); } }
private function checkAdminHomeTabConfig(HomeTabConfig $homeTabConfig, $homeTabType) { if (!is_null($homeTabConfig->getUser()) || !is_null($homeTabConfig->getWorkspace()) || $homeTabConfig->getType() !== 'admin_' . $homeTabType) { throw new AccessDeniedException(); } }
private function checkUserAccessForWorkspaceUserHomeTabConfig(HomeTabConfig $homeTabConfig, User $user) { $homeTabConfigUser = $homeTabConfig->getUser(); if ($homeTabConfig->getType() !== 'workspace_user' || is_null($homeTabConfigUser) || $homeTabConfigUser->getId() !== $user->getId()) { throw new AccessDeniedException(); } }