authorize() public method

public authorize ( string $controller, string $action ) : ManaPHP\Http\ResponseInterface | false | void
$controller string
$action string
return ManaPHP\Http\ResponseInterface | false | void
Example #1
0
 /**
  * @return bool
  * @throws \ManaPHP\Security\CsrfToken\Exception
  * @throws \ManaPHP\Http\Request\Exception
  * @throws \ManaPHP\Security\Crypt\Exception
  */
 public function _eventHandlerBeforeExecuteRoute()
 {
     $ignoreMethods = ['GET', 'HEAD', 'OPTIONS'];
     if (isset($this->csrfToken) && !in_array($this->request->getMethod(), $ignoreMethods, true)) {
         $this->csrfToken->verify();
     }
     $r = $this->_moduleObject->authorize($this->dispatcher->getControllerName(), $this->dispatcher->getActionName());
     if ($r === false || is_object($r)) {
         return false;
     } else {
         return true;
     }
 }