Example #1
0
 public function checkRequirements($element)
 {
     parent::checkRequirements($element);
     if (!$this->user->isLoggedIn()) {
         if ($this->user->logoutReason === Nette\Security\IUserStorage::INACTIVITY) {
             $this->flashMessage('Byli jste odhlášeni z důvodu nečinnosti. Přihlaste se prosím znovu.', 'danger');
         } else {
             $this->flashMessage('Pro vstup do této sekce se musíte přihlásit.', 'danger');
         }
         $this->redirect(':Auth:Sign:in', ['backlink' => $this->storeRequest()]);
     } elseif (!$this->user->isAllowed($this->name, Authorizator::READ)) {
         $this->flashMessage('Přístup byl odepřen. Nemáte oprávnění k zobrazení této stránky.', 'danger');
         $this->redirect(':Auth:Sign:in', ['backlink' => $this->storeRequest()]);
     }
 }