public function handleAction(Request $request) { $user = $this->userService->loadUserByCredentials($request->username, $request->password); $this->repository->setCurrentUser($user); $contentCreateStruct = $this->contentProvider->newContentCreateStructFromRequest($request); $locationCreateStruct = $this->contentProvider->newLocationCreateStructFromRequest($request); $content = $this->contentService->createContent($contentCreateStruct, array($locationCreateStruct)); $this->contentService->publishVersion($content->versionInfo); }
/** * Loads a user for the given login and password * * @param string $login * @param string $password the plain password * * @return \eZ\Publish\API\Repository\Values\User\User * * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a user with the given credentials was not found */ public function loadUserByCredentials($login, $password) { return $this->service->loadUserByCredentials($login, $password); }
private function login($username, $password) { $this->repository->setCurrentUser($this->userService->loadUserByCredentials($username, $password)); }
/** * The content is located below the Root folder. */ public function newLocationCreateStructFromRequest(Request $request) { $user = $this->userService->loadUserByCredentials($request->username, $request->password); return $this->locationService->newLocationCreateStruct($user->contentInfo->mainLocationId); }