/** * {@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; }
/** * {@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; }
/** * {@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; }
/** * @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)); }
/** * {@inheritdoc} */ public function handle(Route $route, array $inputs) { return $this->invoker->call($route->getHandler(), [$inputs]); }