'Returns a list of enrollments for the given user, along with
information about previous manual enrollment changes.'

@method_decorator(require_support_permission)
def get(self, request, username_or_email):

    try:
        user = User.objects.get((Q(username=username_or_email) | Q(email=username_or_email)))
    except User.DoesNotExist:
        return JsonResponse([])
    enrollments = get_enrollments(user.username)
    for enrollment in enrollments:
        enrollment.update(**enrollment.pop('course_details'))
        course_key = CourseKey.from_string(enrollment['course_id'])
        enrollment['course_modes'] = self.get_course_modes(course_key)
        self.include_verified_mode_info(enrollment, course_key)
        enrollment['manual_enrollment'] = self.manual_enrollment_data(enrollment, course_key)
    return JsonResponse(enrollments)
