public function moveUserGroup($groupPath, Request $request)
{
$userGroupLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($groupPath));
$userGroup = $this->userService->loadUserGroup($userGroupLocation->contentId);
$locationPath = $this->requestParser->parseHref($request->headers->get('Destination'), 'groupPath');
try {
$destinationGroupLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($locationPath));
} catch (ApiExceptions\NotFoundException $e) {
throw new Exceptions\ForbiddenException($e->getMessage());
}
try {
$destinationGroup = $this->userService->loadUserGroup($destinationGroupLocation->contentId);
} catch (ApiExceptions\NotFoundException $e) {
throw new Exceptions\ForbiddenException($e->getMessage());
}
$this->userService->moveUserGroup($userGroup, $destinationGroup);
return new Values\ResourceCreated($this->router->generate('ezpublish_rest_loadUserGroup', array('groupPath' => trim($destinationGroupLocation->pathString, '/') . '/' . $userGroupLocation->id)));
}