Ejemplo n.º 1
0
def get_mobile_course(course_id, user):
    """
    Return only a CourseDescriptor if the course is mobile-ready or if the
    requesting user is a staff member.
    """
    course = modulestore().get_course(course_id, depth=None)
    if mobile_available_when_enrolled(course, user):
        return course

    raise PermissionDenied(detail="Course not available on mobile.")
Ejemplo n.º 2
0
def get_mobile_course(course_id, user):
    """
    Return only a CourseDescriptor if the course is mobile-ready or if the
    requesting user is a staff member.
    """
    course = modulestore().get_course(course_id, depth=None)
    if mobile_available_when_enrolled(course, user):
        return course

    raise PermissionDenied(detail="Course not available on mobile.")
Ejemplo n.º 3
0
def mobile_course_enrollments(enrollments, user):
    """
    Return enrollments only if courses are mobile_available (or if the user has
    privileged (beta, staff, instructor) access)

    :param enrollments is a list of CourseEnrollments.
    """
    for enr in enrollments:
        course = enr.course

        if mobile_available_when_enrolled(course, user):
            yield enr
Ejemplo n.º 4
0
def mobile_course_enrollments(enrollments, user):
    """
    Return enrollments only if courses are mobile_available (or if the user has
    privileged (beta, staff, instructor) access)

    :param enrollments is a list of CourseEnrollments.
    """
    for enr in enrollments:
        course = enr.course

        if mobile_available_when_enrolled(course, user):
            yield enr