@detail_route(methods=['<STR_LIT>'], permission_classes=[<EOL>permissions.IsAuthenticated,<EOL>HasEnterpriseEnrollmentAPIAccess,<EOL>])<EOL><INDENT>@permission_required('<STR_LIT>', fn=lambda request, pk: pk)<EOL>def course_enrollments(self, request, pk):<DEDENT>
enterprise_customer = self.get_object()<EOL>serializer = serializers.EnterpriseCustomerCourseEnrollmentsSerializer(<EOL>data=request.data,<EOL>many=True,<EOL>context={<EOL>'<STR_LIT>': enterprise_customer,<EOL>'<STR_LIT>': request.user,<EOL>}<EOL>)<EOL>if serializer.is_valid():<EOL><INDENT>serializer.save()<EOL>return Response(serializer.data, status=HTTP_200_OK)<EOL><DEDENT>return Response(serializer.errors, status=HTTP_400_BAD_REQUEST)<EOL>
Creates a course enrollment for an EnterpriseCustomerUser.