/** * */ protected function checkUserRights($page) { if ($this->user && !$this->isOwner) { if (!$this->user->hasRight($page)) { throw new AccessNotAllowedException(); } } }
/** * * @param User $user * @return array */ public function getItems(User $user = null) { if ($user === null) { return $this->items; } $items = []; foreach ($this->items as $item) { if ($item->getRight() == '' || $user->hasRight($item->getRight())) { $items[] = $item; } } return $this->trimSeparators($items); }