Пример #1
0
def manually_add_to_group(obj):
    """
    Adds...
    """
    from psmdlsyncer.php.ModUserEnrollments import ModUserEnrollments
    psi = ModUserEnrollments()

    group_id = input("Group ID: ")
    student_ids = input("Student IDs (comma sep)\n:")
    student_ids = student_ids.split(',')
    student_ids = [s.strip() for s in student_ids]

    from psmdlsyncer.models.datastores.autosend import AutoSendTree
    right = AutoSendTree()
    right.process()

    for stu in student_ids:
        print("Looking up student {}".format(stu))
        student = right.students.get_key(stu)
        if student:
            print("Adding {} to group {}".format(student, group_id))
            psi.add_user_to_group(student.idnumber, group_id)
            print("Adding parents of {} to group {}".format(student, group_id))
            psi.add_user_to_group(student.family_id, group_id)
        else:
            from IPython import embed;embed()
from psmdlsyncer.php.ModUserEnrollments import ModUserEnrollments

if __name__ == "__main__":

    psi = ModUserEnrollments()
    psi.add_user_to_group("32352", "darkosaboMATST10")