setAuthorizator() public method

Sets authorization handler.
public setAuthorizator ( Nette\Security\IAuthorizator $handler ) : self
$handler Nette\Security\IAuthorizator
return self
Example #1
0
 /**
  * Startup method
  * @return void
  */
 public function startup()
 {
     parent::startup();
     $this->lang = $this->translator->setLanguage($this->lang);
     $this->answers[0] = _("No");
     $this->answers[1] = _("Yes");
     // load user to presenter
     $this->user = $this->getUser();
     // zkusi jestli je uzivatel prihlasen
     if (!$this->user->isLoggedIn()) {
         $this->redirect(":User:Authenticator:default", array('backlink' => $this->storeRequest()));
     }
     $this->lang = $this->user->getIdentity()->getData()["lang"];
     $this->user->setAuthorizator(new \UserModule\Authorizator());
     return;
 }
 /**
  * @param \Nette\Security\User $user
  */
 public function setup(User $user)
 {
     $user->getStorage()->setNamespace($this->namespace);
     $user->setAuthenticator($this->authenticator);
     $user->setAuthorizator($this->authorizator);
 }