Esempio n. 1
0
 /**
  * Updates a user group
  *
  * @param $groupPath
  *
  * @return \eZ\Publish\Core\REST\Server\Values\RestUserGroup
  */
 public function updateUserGroup($groupPath)
 {
     $userGroupLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($groupPath));
     $userGroup = $this->userService->loadUserGroup($userGroupLocation->contentId);
     $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($userGroup->getVersionInfo()->getContentInfo(), $section);
     }
     $updatedGroup = $this->userService->updateUserGroup($userGroup, $updateStruct->userGroupUpdateStruct);
     $contentType = $this->contentTypeService->loadContentType($updatedGroup->getVersionInfo()->getContentInfo()->contentTypeId);
     return new Values\RestUserGroup($updatedGroup, $contentType, $updatedGroup->getVersionInfo()->getContentInfo(), $userGroupLocation, $this->contentService->loadRelations($updatedGroup->getVersionInfo()));
 }
 /**
  * Updates the group profile with fields and meta data
  *
  * 4.x: If the versionUpdateStruct is set in $userGroupUpdateStruct, this method internally creates a content draft, updates ts with the provided data
  * and publishes the draft. If a draft is explicitly required, the user group can be updated via the content service methods.
  *
  * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup
  * @param \eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct $userGroupUpdateStruct
  *
  * @return \eZ\Publish\API\Repository\Values\User\UserGroup
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to move the user group
  * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $userGroupUpdateStruct is not valid
  * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is set empty
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if a field value is not accepted by the field type
  */
 public function updateUserGroup(UserGroup $userGroup, UserGroupUpdateStruct $userGroupUpdateStruct)
 {
     $returnValue = $this->service->updateUserGroup($userGroup, $userGroupUpdateStruct);
     $this->signalDispatcher->emit(new UpdateUserGroupSignal(array('userGroupId' => $userGroup->id)));
     return $returnValue;
 }