eZ\Publish\Core\REST\Server\Controller\User::createUser PHP 메소드

createUser() 공개 메소드

Create a new user group in the given group.
public createUser ( $groupPath, Request $request ) : CreatedUser
$groupPath
$request Symfony\Component\HttpFoundation\Request
리턴 eZ\Publish\Core\REST\Server\Values\CreatedUser
    public function createUser($groupPath, Request $request)
    {
        $userGroupLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($groupPath));
        $userGroup = $this->userService->loadUserGroup($userGroupLocation->contentId);
        $userCreateStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()));
        try {
            $createdUser = $this->userService->createUser($userCreateStruct, array($userGroup));
        } catch (ApiExceptions\InvalidArgumentException $e) {
            throw new ForbiddenException($e->getMessage());
        }
        $createdContentInfo = $createdUser->getVersionInfo()->getContentInfo();
        $createdLocation = $this->locationService->loadLocation($createdContentInfo->mainLocationId);
        $contentType = $this->contentTypeService->loadContentType($createdContentInfo->contentTypeId);
        return new Values\CreatedUser(array('user' => new Values\RestUser($createdUser, $contentType, $createdContentInfo, $createdLocation, $this->contentService->loadRelations($createdUser->getVersionInfo()))));
    }