public function assignRoleToUser($userId, Request $request)
{
$roleAssignment = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()));
$user = $this->userService->loadUser($userId);
$role = $this->roleService->loadRole($roleAssignment->roleId);
try {
$this->roleService->assignRoleToUser($role, $user, $roleAssignment->limitation);
} catch (LimitationValidationException $e) {
throw new BadRequestException($e->getMessage());
}
$roleAssignments = $this->roleService->getRoleAssignmentsForUser($user);
return new Values\RoleAssignmentList($roleAssignments, $user->id);
}