Example #1
0
def _users_assign_default_role(course_id):
    """
    Assign 'Student' role to all previous users (if any) for this course
    """
    enrollments = CourseEnrollment.objects.filter(course_id=course_id)
    for enrollment in enrollments:
        assign_default_role(course_id, enrollment.user)
Example #2
0
def _users_assign_default_role(course_id):
    """
    Assign 'Student' role to all previous users (if any) for this course
    """
    enrollments = CourseEnrollment.objects.filter(course_id=course_id)
    for enrollment in enrollments:
        assign_default_role(course_id, enrollment.user)
    def handle(self, *args, **options):
        if len(args) != 0:
            raise CommandError("This Command takes no arguments")

        print "Updated roles for ",
        for i, enrollment in enumerate(CourseEnrollment.objects.filter(is_active=1), start=1):
            assign_default_role(None, enrollment)
            if i % 1000 == 0:
                print "{0}...".format(i),
        print
    def handle(self, *args, **options):
        if len(args) != 0:
            raise CommandError("This Command takes no arguments")

        print "Updated roles for ",
        for i, enrollment in enumerate(CourseEnrollment.objects.all(), start=1):
            assign_default_role(None, enrollment)
            if i % 1000 == 0:
                print "{0}...".format(i),
        print
Example #5
0
def initialize_permissions(course_key, user_who_created_course):
    """
    Initializes a new course by enrolling the course creator as a student,
    and initializing Forum by seeding its permissions and assigning default roles.
    """
    # seed the forums
    seed_permissions_roles(course_key)

    # auto-enroll the course creator in the course so that "View Live" will work.
    CourseEnrollment.enroll(user_who_created_course, course_key)

    # set default forum roles (assign 'Student' role)
    assign_default_role(course_key, user_who_created_course)
Example #6
0
def initialize_permissions(course_key, user_who_created_course):
    """
    Initializes a new course by enrolling the course creator as a student,
    and initializing Forum by seeding its permissions and assigning default roles.
    """
    # seed the forums
    seed_permissions_roles(course_key)

    # auto-enroll the course creator in the course so that "View Live" will work.
    CourseEnrollment.enroll(user_who_created_course, course_key)

    # set default forum roles (assign 'Student' role)
    assign_default_role(course_key, user_who_created_course)
    def handle(self, *args, **options):
        if len(args) == 0:
            raise CommandError("Please provide a course id")
        if len(args) > 1:
            raise CommandError("Too many arguments")
        course_id = args[0]

        print "Updated roles for ",
        for i, enrollment in enumerate(CourseEnrollment.objects.filter(course_id=course_id, is_active=1), start=1):
            assign_default_role(None, enrollment)
            if i % 1000 == 0:
                print "{0}...".format(i),
        print
    def handle(self, *args, **options):
        if len(args) == 0:
            raise CommandError("Please provide a course id")
        if len(args) > 1:
            raise CommandError("Too many arguments")
        course_id = args[0]

        print "Updated roles for ",
        for i, enrollment in enumerate(CourseEnrollment.objects.filter(course_id=course_id), start=1):
            assign_default_role(None, enrollment)
            if i % 1000 == 0:
                print "{0}...".format(i),
        print