Example #1
0
def member_management_eval(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)

    if not ldap_is_eval_director(user_dict['account']):
        return "must be eval director", 403

    post_data = request.get_json()

    if 'siteLockdown' in post_data:
        log.info('Changed Site Lockdown: {}'.format(post_data['siteLockdown']))
        EvalSettings.query.update(
            {
                'site_lockdown': post_data['siteLockdown']
            })

    if 'introForm' in post_data:
        log.info('Changed Intro Form: {}'.format(post_data['introForm']))
        EvalSettings.query.update(
            {
                'intro_form_active': post_data['introForm']
            })

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #2
0
def member_management_uploaduser(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)

    if not ldap_is_eval_director(user_dict['account']):
        return "must be eval director", 403

    f = request.files['file']
    if not f:
        return "No file", 400

    try:
        stream = io.StringIO(f.stream.read().decode("UTF8"), newline=None)
        csv_input = csv.reader(stream)

        for new_user in csv_input:
            name = new_user[0]
            onfloor_status = new_user[1]

            if new_user[2]:
                room_number = new_user[2]
            else:
                room_number = None

            log.info('Create Freshman Account for {} via CSV Upload'.format(name))
            db.session.add(FreshmanAccount(name, onfloor_status, room_number))

        db.session.flush()
        db.session.commit()
        return jsonify({"success": True}), 200
    except csv.Error:
        return "file could not be processed", 400
Example #3
0
def display_member_management():
    log = logger.new(request=request)
    log.info('Display Member Management')

    username = request.headers.get('x-webauth-user')
    account = ldap_get_member(username)

    if not ldap_is_eval_director(account) and not ldap_is_financial_director(
            account):
        return "must be eval director", 403

    member_list = get_members_info()
    onfloor_list = get_onfloor_members()

    co_op_list = [(ldap_get_member(member.uid).displayName, member.semester, member.uid) \
        for member in CurrentCoops.query.filter(
            CurrentCoops.date_created > start_of_year(),
            CurrentCoops.semester != "Neither")]

    freshmen = FreshmanAccount.query
    freshmen_list = []

    for freshman_user in freshmen:  # pylint: disable=not-an-iterable
        freshmen_list.append({
            "id":
            freshman_user.id,
            "name":
            freshman_user.name,
            "onfloor":
            freshman_user.onfloor_status,
            "room":
            "" if freshman_user.room_number is None else
            freshman_user.room_number,
            "eval_date":
            freshman_user.eval_date
        })

    settings = EvalSettings.query.first()
    if settings:
        lockdown = settings.site_lockdown
        intro_form = settings.intro_form_active
        accept_dues_until = settings.accept_dues_until
    else:
        lockdown = False
        intro_form = False
        accept_dues_until = datetime.now()

    return render_template(request,
                           "member_management.html",
                           username=username,
                           active=member_list,
                           num_current=len(member_list),
                           num_active=len(ldap_get_active_members()),
                           num_fresh=len(freshmen_list),
                           num_onfloor=len(onfloor_list),
                           freshmen=freshmen_list,
                           co_op=co_op_list,
                           site_lockdown=lockdown,
                           accept_dues_until=accept_dues_until,
                           intro_form=intro_form)
Example #4
0
def render_template(request, template_name, **kwargs):
    user_name = request.headers.get('x-webauth-user')

    # TODO maybe use the webauth request decorator

    if EvalSettings.query.first() is None:
        db.session.add(EvalSettings())
        db.session.flush()
        db.session.commit()

    lockdown = EvalSettings.query.first().site_lockdown
    is_active = ldap_is_active(user_name)
    is_alumni = ldap_is_alumni(user_name)
    is_eboard = ldap_is_eboard(user_name)
    is_financial = ldap_is_financial_director(user_name)
    is_eval = ldap_is_eval_director(user_name)
    is_intromember = ldap_is_intromember(user_name)

    if is_eval:
        lockdown = False

    return flask_render_template(template_name,
                                 lockdown=lockdown,
                                 is_active=is_active,
                                 is_alumni=is_alumni,
                                 is_eboard=is_eboard,
                                 is_eval_director=is_eval,
                                 is_financial_director=is_financial,
                                 is_intromember=is_intromember,
                                 **kwargs)
Example #5
0
def conditional_review(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)

    if not ldap_is_eval_director(user_dict['account']):
        return redirect("/dashboard", code=302)

    post_data = request.get_json()
    cid = post_data['id']
    status = post_data['status']

    log.info('Updated conditional-{} to {}'.format(cid, status))
    conditional = Conditional.query.filter(Conditional.id == cid)
    cond_obj = conditional.first()

    conditional.update({'status': status})
    if cond_obj.s_evaluation:
        SpringEval.query.filter(SpringEval.id == cond_obj.s_evaluation).update(
            {'status': status})
    elif cond_obj.i_evaluation:
        FreshmanEvalData.query.filter(
            FreshmanEvalData.id == cond_obj.i_evaluation).update(
                {'freshman_eval_result': status})

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #6
0
def member_management_deleteuser(fid):
    log = logger.new(user_name=request.headers.get("x-webauth-user"),
                     request_id=str(uuid.uuid4()))
    log.info('api', action='edit fid user')

    user_name = request.headers.get('x-webauth-user')

    if not ldap_is_eval_director(user_name):
        return "must be eval director", 403

    if not fid.isdigit():
        return "can only delete freshman accounts", 400

    logger.info('backend', action="delete freshman account %s" % (fid))

    for fca in FreshmanCommitteeAttendance.query.filter(
            FreshmanCommitteeAttendance.fid == fid):
        db.session.delete(fca)

    for fts in FreshmanSeminarAttendance.query.filter(
            FreshmanSeminarAttendance.fid == fid):
        db.session.delete(fts)

    for fhm in FreshmanHouseMeetingAttendance.query.filter(
            FreshmanHouseMeetingAttendance.fid == fid):
        db.session.delete(fhm)

    FreshmanAccount.query.filter(FreshmanAccount.id == fid).delete()

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #7
0
def member_management_eval():
    log = logger.new(user_name=request.headers.get("x-webauth-user"),
                     request_id=str(uuid.uuid4()))
    log.info('api', action='submit site settings')

    user_name = request.headers.get('x-webauth-user')

    if not ldap_is_eval_director(user_name):
        return "must be eval director", 403

    post_data = request.get_json()

    if 'siteLockdown' in post_data:
        logger.info('backend',
                    action="changed site lockdown setting to %s" %
                    post_data['siteLockdown'])
        EvalSettings.query.update({'site_lockdown': post_data['siteLockdown']})

    if 'introForm' in post_data:
        logger.info('backend',
                    action="changed intro form setting to %s" %
                    post_data['introForm'])
        EvalSettings.query.update(
            {'intro_form_active': post_data['introForm']})

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #8
0
def conditional_review():
    log = logger.new(user_name=request.headers.get("x-webauth-user"),
                     request_id=str(uuid.uuid4()))
    log.info('api', action='review a conditional')

    # get user data
    user_name = request.headers.get('x-webauth-user')

    if not ldap_is_eval_director(user_name):
        return redirect("/dashboard", code=302)

    post_data = request.get_json()
    cid = post_data['id']
    status = post_data['status']

    logger.info(action="updated conditional-%s to %s" % (cid, status))
    Conditional.query.filter(
        Conditional.id == cid). \
        update(
        {
            'status': status
        })

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #9
0
def major_project_review():
    log = logger.new(user_name=request.headers.get("x-webauth-user"),
                     request_id=str(uuid.uuid4()))
    log.info('api', action='review major project')

    # get user data
    user_name = request.headers.get('x-webauth-user')

    if not ldap_is_eval_director(user_name):
        return redirect("/dashboard", code=302)

    post_data = request.get_json()
    pid = post_data['id']
    status = post_data['status']

    print(post_data)
    MajorProject.query.filter(
        MajorProject.id == pid). \
        update(
        {
            'status': status
        })
    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #10
0
def member_management_upgrade_user():
    log = logger.new(user_name=request.headers.get("x-webauth-user"),
                     request_id=str(uuid.uuid4()))
    log.info('api', action='convert fid to uid entry')

    user_name = request.headers.get('x-webauth-user')

    if not ldap_is_eval_director(user_name):
        return "must be eval director", 403

    post_data = request.get_json()

    fid = post_data['fid']
    uid = post_data['uid']
    signatures_missed = post_data['sigsMissed']

    logger.info('backend',
                action="upgrade freshman-%s to %s sigsMissed: %s" %
                (fid, uid, signatures_missed))
    acct = FreshmanAccount.query.filter(FreshmanAccount.id == fid).first()

    new_acct = FreshmanEvalData(uid, signatures_missed)
    new_acct.eval_date = acct.eval_date

    db.session.add(new_acct)
    for fca in FreshmanCommitteeAttendance.query.filter(
            FreshmanCommitteeAttendance.fid == fid):
        db.session.add(MemberCommitteeAttendance(uid, fca.meeting_id))
        # XXX this might fail horribly #yoloswag
        db.session.delete(fca)

    for fts in FreshmanSeminarAttendance.query.filter(
            FreshmanSeminarAttendance.fid == fid):
        db.session.add(MemberSeminarAttendance(uid, fts.seminar_id))
        # XXX this might fail horribly #yoloswag
        db.session.delete(fts)

    for fhm in FreshmanHouseMeetingAttendance.query.filter(
            FreshmanHouseMeetingAttendance.fid == fid):
        db.session.add(
            MemberHouseMeetingAttendance(uid, fhm.meeting_id, fhm.excuse,
                                         fhm.attendance_status))
        # XXX this might fail horribly #yoloswag
        db.session.delete(fhm)

    if acct.onfloor_status:
        db.session.add(OnFloorStatusAssigned(uid, datetime.now()))

    if acct.room_number:
        ldap_set_roomnumber(uid, acct.room_number)

    # XXX this might fail horribly #yoloswag
    db.session.delete(acct)

    db.session.flush()
    db.session.commit()

    clear_onfloor_members_cache()

    return jsonify({"success": True}), 200
Example #11
0
def change_room_numbers(rmnumber):
    log = logger.new(request=request)

    username = request.headers.get('x-webauth-user')
    account = ldap_get_member(username)
    update = request.get_json()

    if not ldap_is_eval_director(account):
        return "must be eval director", 403

    # Get the current list of people living on-floor.
    current_students = ldap_get_current_students()

    # Set the new room number for each person in the list.

    for occupant in update["occupants"]:
        if occupant != "":
            account = ldap_get_member(occupant)
            account.roomNumber = rmnumber
            log.info('{} assigned to room {}'.format(occupant, rmnumber))
            ldap_set_active(account)
            log.info('{} marked as active because of room assignment'.format(
                occupant))
    # Delete any old occupants that are no longer in room.
        for old_occupant in [
                account for account in current_students
                if ldap_get_roomnumber(account) == str(rmnumber)
                and account.uid not in update["occupants"]
        ]:
            log.info('{} removed from room {}'.format(old_occupant.uid,
                                                      old_occupant.roomNumber))
            old_occupant.roomNumber = None

    return jsonify({"success": True}), 200
Example #12
0
def slideshow_intro_review():
    log = logger.new(user_name=request.headers.get("x-webauth-user"),
                     request_id=str(uuid.uuid4()))
    log.info('api', action='submit intro member evaluation')

    # get user data
    user_name = request.headers.get('x-webauth-user')

    if not ldap_is_eval_director(user_name):
        return redirect("/dashboard", code=302)

    post_data = request.get_json()
    uid = post_data['uid']
    status = post_data['status']

    logger.info("backend",
                action="submit intro eval for %s status: %s" % (uid, status))
    FreshmanEvalData.query.filter(
        FreshmanEvalData.uid == uid and
        FreshmanEvalData.active). \
        update(
        {
            'freshman_eval_result': status
        })

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #13
0
def major_project_review():
    log = logger.new(request=request)

    # get user data
    user_name = request.headers.get('x-webauth-user')
    account = ldap_get_member(user_name)

    if not ldap_is_eval_director(account):
        return redirect("/dashboard", code=302)

    post_data = request.get_json()
    pid = post_data['id']
    status = post_data['status']

    log.info('{} Major Project ID: {}'.format(status, pid))

    print(post_data)
    MajorProject.query.filter(
        MajorProject.id == pid). \
        update(
        {
            'status': status
        })
    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #14
0
def member_management_uploaduser():
    user_name = request.headers.get('x-webauth-user')

    if not ldap_is_eval_director(user_name):
        return "must be eval director", 403

    f = request.files['file']
    if not f:
        return "No file", 400

    try:
        stream = io.StringIO(f.stream.read().decode("UTF8"), newline=None)
        csv_input = csv.reader(stream)

        for new_user in csv_input:
            name = new_user[0]
            onfloor_status = new_user[1]

            if new_user[2]:
                room_number = new_user[2]
            else:
                room_number = None

            db.session.add(FreshmanAccount(name, onfloor_status, room_number))

        db.session.flush()
        db.session.commit()
        return jsonify({"success": True}), 200
    except csv.Error:
        return "file could not be processed", 400
def member_management_deleteuser(fid, user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)
    log.info('Delete freshman-{}'.format(fid))

    if not ldap_is_eval_director(user_dict['account']):
        return "must be eval director", 403

    if not fid.isdigit():
        return "can only delete freshman accounts", 400

    log.info('backend', action="delete freshman account %s" % fid)

    for fca in FreshmanCommitteeAttendance.query.filter(
            FreshmanCommitteeAttendance.fid == fid):
        db.session.delete(fca)

    for fts in FreshmanSeminarAttendance.query.filter(
            FreshmanSeminarAttendance.fid == fid):
        db.session.delete(fts)

    for fhm in FreshmanHouseMeetingAttendance.query.filter(
            FreshmanHouseMeetingAttendance.fid == fid):
        db.session.delete(fhm)

    FreshmanAccount.query.filter(FreshmanAccount.id == fid).delete()

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #16
0
def member_management_adduser():
    log = logger.new(user_name=request.headers.get("x-webauth-user"),
                     request_id=str(uuid.uuid4()))
    log.info('api', action='add fid user')

    user_name = request.headers.get('x-webauth-user')

    if not ldap_is_eval_director(user_name):
        return "must be eval director", 403

    post_data = request.get_json()

    name = post_data['name']
    onfloor_status = post_data['onfloor']
    room_number = post_data['roomNumber']

    # empty room numbers should be NULL
    if room_number == "":
        room_number = None

    logger.info('backend',
                action="add f_%s as onfloor: %s with room_number: %s" %
                (name, onfloor_status, room_number))
    db.session.add(FreshmanAccount(name, onfloor_status, room_number))
    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #17
0
def slideshow_intro_review():
    log = logger.new(request=request)

    # get user data
    user_name = request.headers.get('x-webauth-user')
    account = ldap_get_member(user_name)

    if not ldap_is_eval_director(account):
        return redirect("/dashboard", code=302)

    post_data = request.get_json()
    uid = post_data['uid']
    status = post_data['status']

    log.info('Intro Eval for {}: {}'.format(uid, status))
    FreshmanEvalData.query.filter(
        FreshmanEvalData.uid == uid and
        FreshmanEvalData.active). \
        update(
        {
            'freshman_eval_result': status
        })

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #18
0
def alter_house_excuse(uid, hid, user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)

    if not ldap_is_eval_director(user_dict['account']):
        return "must be eval director", 403

    post_data = request.get_json()
    hm_status = post_data['status']
    hm_excuse = post_data['excuse']

    if not uid.isdigit():
        log.info('Mark {} as {} for HM ID: {}'.format(uid, hm_status, hid))
        MemberHouseMeetingAttendance.query.filter(
            MemberHouseMeetingAttendance.uid == uid,
            MemberHouseMeetingAttendance.meeting_id == hid).update({
                'excuse':
                hm_excuse,
                'attendance_status':
                hm_status
            })
    else:
        log.info('Mark {} as {} for HM ID: {}'.format(uid, hm_status, hid))
        FreshmanHouseMeetingAttendance.query.filter(
            FreshmanHouseMeetingAttendance.fid == uid,
            FreshmanHouseMeetingAttendance.meeting_id == hid).update({
                'excuse':
                hm_excuse,
                'attendance_status':
                hm_status
            })

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
Example #19
0
def alter_house_attendance(uid, hid):
    log = logger.new(request=request)
    user_name = request.headers.get('x-webauth-user')

    account = ldap_get_member(user_name)
    if not ldap_is_eval_director(account):
        return "must be evals", 403

    if not uid.isdigit():
        log.info('Mark {} Present for House Meeting ID: {}'.format(uid, hid))
        member_meeting = MemberHouseMeetingAttendance.query.filter(
            MemberHouseMeetingAttendance.uid == uid,
            MemberHouseMeetingAttendance.meeting_id == hid).first()
        member_meeting.attendance_status = "Attended"
        db.session.commit()
        return jsonify({"success": True}), 200

    log.info('Mark freshman-{} Present for House Meeting ID: {}'.format(
        uid, hid))
    freshman_meeting = FreshmanHouseMeetingAttendance.query.filter(
        FreshmanHouseMeetingAttendance.fid == uid,
        FreshmanHouseMeetingAttendance.meeting_id == hid).first()

    freshman_meeting.attendance_status = "Attended"
    db.session.commit()
    return jsonify({"success": True}), 200
Example #20
0
def introductory_project_submit(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)

    if not ldap_is_eval_director(user_dict['account']):
        return "must be eval director", 403

    post_data = request.get_json()

    if not isinstance(post_data, list):
        abort(400)

    for intro_member in post_data:
        if not isinstance(intro_member, dict):
            abort(400)

        if 'uid' not in intro_member or 'status' not in intro_member:
            abort(400)

        if intro_member['status'] not in ['Passed', 'Pending', 'Failed']:
            abort(400)

        log.info('Freshmen Project {} for {}'.format(intro_member['status'], intro_member['uid']))

        FreshmanEvalData.query.filter(FreshmanEvalData.uid == intro_member['uid']).update({
            'freshman_project': intro_member['status']
        })

    db.session.flush()
    db.session.commit()

    return jsonify({"success": True}), 200
Example #21
0
def member_management_upgrade_user(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)

    if not ldap_is_eval_director(user_dict['account']):
        return "must be eval director", 403

    post_data = request.get_json()

    fid = post_data['fid']
    uid = post_data['uid']
    signatures_missed = post_data['sigsMissed']

    log.info('Upgrade freshman-{} to Account: {}'.format(fid, uid))

    acct = FreshmanAccount.query.filter(
        FreshmanAccount.id == fid).first()

    new_acct = FreshmanEvalData(uid, signatures_missed)
    new_acct.eval_date = acct.eval_date

    db.session.add(new_acct)
    for fca in FreshmanCommitteeAttendance.query.filter(FreshmanCommitteeAttendance.fid == fid):
        db.session.add(MemberCommitteeAttendance(uid, fca.meeting_id))
        db.session.delete(fca)

    for fts in FreshmanSeminarAttendance.query.filter(FreshmanSeminarAttendance.fid == fid):
        db.session.add(MemberSeminarAttendance(uid, fts.seminar_id))
        db.session.delete(fts)

    for fhm in FreshmanHouseMeetingAttendance.query.filter(FreshmanHouseMeetingAttendance.fid == fid):
        # Don't duplicate HM attendance records
        mhm = MemberHouseMeetingAttendance.query.filter(
            MemberHouseMeetingAttendance.meeting_id == fhm.meeting_id).first()
        if mhm is None:
            db.session.add(MemberHouseMeetingAttendance(
                uid, fhm.meeting_id, fhm.excuse, fhm.attendance_status))
        else:
            log.info('Duplicate house meeting attendance! fid: {}, uid: {}, id: {}'.format(
                fid,
                uid,
                fhm.meeting_id))
        db.session.delete(fhm)

    new_account = ldap_get_member(uid)
    if acct.onfloor_status:
        db.session.add(OnFloorStatusAssigned(uid, datetime.now()))
        ldap_set_onfloor(new_account)

    if acct.room_number:
        ldap_set_roomnumber(new_account, acct.room_number)

    db.session.delete(acct)

    db.session.flush()
    db.session.commit()

    clear_members_cache()

    return jsonify({"success": True}), 200
Example #22
0
def introductory_project(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)
    log.info('Display Freshmen Project Management')

    if not ldap_is_eval_director(user_dict['account']):
        return "must be eval director", 403

    return render_template('introductory_project.html',
                           username=user_dict['username'],
                           intro_members=display_intro_evals(internal=True))
Example #23
0
def clear_cache(user_dict=None):
    if not ldap_is_eval_director(user_dict['account']) and not ldap_is_rtp(user_dict['account']):
        return redirect("/dashboard")

    log = logger.new(request=request, auth_dict=user_dict)
    log.info('Purge All Caches')

    clear_all_cached_functions()

    return "cache cleared", 200
Example #24
0
def conditional_delete(cid, user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)
    log.info('Delete conditional-{}'.format(cid))

    if ldap_is_eval_director(user_dict['account']):
        Conditional.query.filter(Conditional.id == cid).delete()
        db.session.flush()
        db.session.commit()
        return jsonify({"success": True}), 200

    return "Must be evals director to delete!", 401
Example #25
0
def slideshow_spring_display(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)
    log.info('Display Membership Evaluations Slideshow')

    if not ldap_is_eval_director(user_dict['account']):
        return redirect("/dashboard")

    return render_template('spring_eval_slideshow.html',
                           username=user_dict['username'],
                           date=datetime.now().strftime("%Y-%m-%d"),
                           members=display_spring_evals(internal=True))
Example #26
0
def display_attendance_hm(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)
    log.info('Display House Meeting Attendance Page')

    if not ldap_is_eval_director(user_dict['account']):
        return redirect("/dashboard")

    return render_template('attendance_hm.html',
                           username=user_dict['username'],
                           date=datetime.now().strftime("%Y-%m-%d"),
                           members=get_non_alumni_non_coop(internal=True))
Example #27
0
def member_management_edituser(uid, user_dict=None):
    if not ldap_is_eval_director(user_dict['account']) and not ldap_is_financial_director(user_dict['account']):
        return "must be eval director", 403

    if not uid.isdigit():
        edit_uid(uid, request, user_dict['username'])
    else:
        edit_fid(uid, request)

    db.session.flush()
    db.session.commit()
    return jsonify({"success": True}), 200
def new_year(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)
    log.info('Display New Year Page')

    if not ldap_is_eval_director(user_dict['account']):
        return "must be eval director", 403

    current_students = ldap_get_current_students()

    return render_template('new_year.html',
                           username=user_dict['username'],
                           current_students=current_students)
Example #29
0
def conditional_delete(cid):
    log = logger.new(user_name=request.headers.get("x-webauth-user"),
                     request_id=str(uuid.uuid4()))
    log.info('api', action='delete conditional')

    user_name = request.headers.get('x-webauth-user')
    if ldap_is_eval_director(user_name):
        Conditional.query.filter(Conditional.id == cid).delete()
        db.session.flush()
        db.session.commit()
        return jsonify({"success": True}), 200
    else:
        return "Must be evals director to delete!", 401
Example #30
0
def clear_all_rooms(user_dict=None):
    log = logger.new(request=request, auth_dict=user_dict)

    if not ldap_is_eval_director(user_dict['account']):
        return "must be eval director", 403
    # Get list of current students.
    current_students = ldap_get_current_students()

    # Find the current occupants and clear them.
    for occupant in current_students:
        log.info('{} removed from room {}'.format(occupant.uid, occupant.roomNumber))
        occupant.roomNumber = None
    return jsonify({"success": True}), 200