/** * @param integer $appId * @return \Fusio\Engine\Model\AppInterface */ private function getApp($appId) { $app = $this->appRepository->get($appId); if (!$app instanceof Model\AppInterface) { $app = new Model\App(); $app->setAnonymous(true); $app->setScopes([]); } return $app; }
public function execute($actionId, $method, $uriFragments, $parameters, $headers, RecordInterface $body = null) { $action = $this->actionTable->get($actionId); if (!empty($action)) { if ($body === null) { $body = new Record(); } $app = $this->appRepository->get(1); $user = $this->userRepository->get(1); $uriFragments = $this->parseQueryString($uriFragments); $parameters = $this->parseQueryString($parameters); $headers = $this->parseQueryString($headers); $context = new Context($actionId, $app, $user); $request = new Request(new HttpRequest(new Uri('/'), $method, $headers), $uriFragments, $parameters, $body); return $this->processor->execute($action->id, $request, $context); } else { return null; } }