Example #1
0
def cadmin_permissions(course_id):
    """ Present a page for them to assign permissions to the course"""
    course = Courses2.get_course(course_id)

    permlist = Permissions.get_course_perms(course_id)
    perms = {}
    for uid, pid in permlist:  # (uid, permission)
        if not uid in perms:
            user = Users2.get_user(uid)
            perms[uid] = {"uname": user["uname"], "fullname": user["fullname"], "pids": []}
        perms[uid]["pids"].append(pid)

    return render_template(
        "courseadmin_permissions.html", perms=perms, course=course, pids=[5, 10, 14, 11, 8, 9, 15, 2]
    )
Example #2
0
def cadmin_permissions(course_id):
    """ Present a page for them to assign permissions to the course"""
    course = Courses2.get_course(course_id)

    permlist = Permissions.get_course_perms(course_id)
    perms = {}
    for uid, pid in permlist:  # (uid, permission)
        if uid not in perms:
            user = Users2.get_user(uid)
            perms[uid] = {
                'uname': user['uname'],
                'fullname': user['fullname'],
                'pids': []
            }
        perms[uid]['pids'].append(pid)

    return render_template("courseadmin_permissions.html",
                           perms=perms,
                           course=course,
                           pids=[5, 10, 14, 11, 8, 9, 15, 2])
Example #3
0
def cadmin_config(course_id):
    """ Allow some course configuration """
    course = Courses2.get_course(course_id)
    if not course:
        abort(404)

    user_id = session["user_id"]
    is_sysadmin = check_perm(user_id, -1, "sysadmin")
    coords = [
        Users2.get_user(perm[0]) for perm in Permissions.get_course_perms(course_id) if perm[1] == 3
    ]  # course_coord
    groups = Courses.get_groups(course_id)
    choosegroups = [group for group in Groups.all_groups() if not group.id in groups]
    return render_template(
        "courseadmin_config.html",
        course=course,
        coords=coords,
        choosegroups=choosegroups,
        groups=groups,
        is_sysadmin=is_sysadmin,
    )
Example #4
0
def cadmin_config(course_id):
    """ Allow some course configuration """
    course = Courses2.get_course(course_id)
    if not course:
        abort(404)

    user_id = session['user_id']
    is_sysadmin = check_perm(user_id, -1, 'sysadmin')
    coords = [
        Users2.get_user(perm[0])
        for perm in Permissions.get_course_perms(course_id) if perm[1] == 3
    ]  # course_coord
    groups = Courses.get_groups(course_id)
    choosegroups = [
        group for group in Groups.all_groups() if group.id not in groups
    ]
    return render_template("courseadmin_config.html",
                           course=course,
                           coords=coords,
                           choosegroups=choosegroups,
                           groups=groups,
                           is_sysadmin=is_sysadmin)