/** * Updates a user * * @param $userId * * @return \eZ\Publish\Core\REST\Server\Values\RestUser */ public function updateUser($userId) { $user = $this->userService->loadUser($userId); $updateStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $this->request->headers->get('Content-Type'), 'Url' => $this->request->getPathInfo()), $this->request->getContent())); if ($updateStruct->sectionId !== null) { $section = $this->sectionService->loadSection($updateStruct->sectionId); $this->sectionService->assignSection($user->getVersionInfo()->getContentInfo(), $section); } $updatedUser = $this->userService->updateUser($user, $updateStruct->userUpdateStruct); $updatedContentInfo = $updatedUser->getVersionInfo()->getContentInfo(); $mainLocation = $this->locationService->loadLocation($updatedContentInfo->mainLocationId); $contentType = $this->contentTypeService->loadContentType($updatedContentInfo->contentTypeId); return new Values\RestUser($updatedUser, $contentType, $updatedContentInfo, $mainLocation, $this->contentService->loadRelations($updatedUser->getVersionInfo())); }
/** * Assigns the content to the given section * this method overrides the current assigned section. * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user does not have access to view provided object * * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo * @param \eZ\Publish\API\Repository\Values\Content\Section $section */ public function assignSection(ContentInfo $contentInfo, Section $section) { $returnValue = $this->service->assignSection($contentInfo, $section); $this->signalDispatcher->emit(new AssignSectionSignal(array('contentId' => $contentInfo->id, 'sectionId' => $section->id))); return $returnValue; }