public function assignRoleToUserGroup($groupPath, Request $request)
{
$roleAssignment = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()));
$groupLocationParts = explode('/', $groupPath);
$groupLocation = $this->locationService->loadLocation(array_pop($groupLocationParts));
$userGroup = $this->userService->loadUserGroup($groupLocation->contentId);
$role = $this->roleService->loadRole($roleAssignment->roleId);
try {
$this->roleService->assignRoleToUserGroup($role, $userGroup, $roleAssignment->limitation);
} catch (LimitationValidationException $e) {
throw new BadRequestException($e->getMessage());
}
$roleAssignments = $this->roleService->getRoleAssignmentsForUserGroup($userGroup);
return new Values\RoleAssignmentList($roleAssignments, $groupPath, true);
}