コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function handle(Route $route, array $inputs)
 {
     if ($route->isSecure() && !$this->user->isAuthenticated()) {
         throw new AuthenticationException();
     }
     return !is_null($this->next) ? $this->next->handle($route, $inputs) : null;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function handle(Route $route, array $inputs)
 {
     $permissions = $route->getRequiredPermissions();
     if (!empty($permissions)) {
         if ($this->user->hasPermission($permissions)) {
             throw new AuthorizationException();
         }
     }
     // Pass the request to the next middleware
     return !is_null($this->next) ? $this->next->handle($route, $inputs) : null;
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function handle(Route $route, array $inputs)
 {
     if ($route->hasValidator()) {
         // Instanciate the validator class
         $validator = $this->container->get($route->getValidator());
         try {
             $validator->validate($inputs);
         } catch (AssertionFailedException $e) {
             throw new ValidationException([$e->getMessage()]);
         }
     }
     // Pass the request to the next middleware
     return !is_null($this->next) ? $this->next->handle($route, $inputs) : null;
 }
コード例 #4
0
 /**
  * @param \Domynation\Http\Route $route
  * @param array $inputs
  */
 private function doLog(Route $route, array $inputs)
 {
     $data = ['user' => ['id' => $this->user->getId(), 'name' => $this->user->getFullName()], 'route' => ['name' => $route->getName(), 'inputs' => $inputs]];
     $this->logger->info("Route: ", utf8_encode_array($data));
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 public function handle(Route $route, array $inputs)
 {
     return $this->invoker->call($route->getHandler(), [$inputs]);
 }