/**
  * @param integer $userId
  * @return \Fusio\Engine\Model\UserInterface
  */
 private function getUser($userId)
 {
     $user = $this->userRepository->get($userId);
     if (!$user instanceof Model\UserInterface) {
         $user = new Model\User();
         $user->setAnonymous(true);
     }
     return $user;
 }
Beispiel #2
0
 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;
     }
 }