public function loadRoleAssignmentForUserGroup($groupPath, $roleId, Request $request)
{
$groupLocationParts = explode('/', $groupPath);
$groupLocation = $this->locationService->loadLocation(array_pop($groupLocationParts));
$userGroup = $this->userService->loadUserGroup($groupLocation->contentId);
$roleAssignments = $this->roleService->getRoleAssignmentsForUserGroup($userGroup);
foreach ($roleAssignments as $roleAssignment) {
if ($roleAssignment->getRole()->id == $roleId) {
return new Values\RestUserGroupRoleAssignment($roleAssignment, $groupPath);
}
}
throw new Exceptions\NotFoundException("Role assignment not found: '{$request->getPathInfo()}'.");
}