eZ\Publish\Core\REST\Server\Controller\User::updateUser PHP Method

updateUser() public method

Updates a user.
public updateUser ( $userId, Request $request ) : RestUser
$userId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\RestUser
    public function updateUser($userId, Request $request)
    {
        $user = $this->userService->loadUser($userId);
        $updateStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type'), 'Url' => $request->getPathInfo()), $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()));
    }