/** * Metoda volaná při spuštění presenteru, v rámci které je řešeno oprávnění přístupu ke zvolenému zdroji */ protected function startup() { $user = $this->getUser(); $action = $this->request->parameters['action'] ? $this->request->parameters['action'] : ''; if (!$user->isAllowed($this->request->presenterName, $action)) { if ($user->isLoggedIn()) { throw new ForbiddenRequestException($this->translator->translate('You are not authorized to access the required resource!')); } else { $this->flashMessage('For access to the required resource, you have to log in!', 'warn'); $this->redirect('User:login', ['backlink' => $this->storeRequest()]); } } parent::startup(); }