Beispiel #1
0
def add_university():
    json = request.get_json()
    uni = json['uni']
    if University.get_uni(uni):
        return jsonify({"error": "University already exists"}), 201
    University.add_university(uni)
    return jsonify({"message": "OK"}), 201
Beispiel #2
0
def add_university():
    json = request.get_json()
    uni = json['uni']
    if University.get_uni(uni):
        return jsonify({"error": "University already exists"}), 201
    University.add_university(uni)
    return jsonify({"message": "OK"}), 201
Beispiel #3
0
def add_college():
    json = request.get_json()
    uni = json['uni']
    college = json['college']
    if University.get_college(uni, college):
        return jsonify({"error": "College already exists"}), 201
    University.add_college(uni, college)
    return jsonify({"message": "OK"}), 201
Beispiel #4
0
def add_college():
    json = request.get_json()
    uni = json['uni']
    college = json['college']
    if University.get_college(uni, college):
        return jsonify({"error": "College already exists"}), 201
    University.add_college(uni, college)
    return jsonify({"message": "OK"}), 201
Beispiel #5
0
def admin_edit_profile_page(user):
    universities = University.get_uni_list()
    profile = User.find_by_email(user)
    mypermissions = User.get_user_permissions(session['email'])
    permissions = [permission_level for permission_level in Database.find(Permissions.COLLECTION, {})]
    return render_template('edit-profile.html', user=user, universities=universities, profile=profile,
                           permissions=permissions, mypermissions=mypermissions)
Beispiel #6
0
def edit_uni_page():
    if session.contains('email') and session['email'] is not None:
        if User.get_user_permissions(session['email']) == 'admin':
            universities = University.get_uni_list()
            return render_template('university-update.html', universities=universities)

    else:
        abort(401)
Beispiel #7
0
def edit_uni_page():
    if session.contains('email') and session['email'] is not None:
        if User.get_user_permissions(session['email']) == 'admin':
            universities = University.get_uni_list()
            return render_template('university-update.html',
                                   universities=universities)

    else:
        abort(401)
Beispiel #8
0
def admin_edit_profile_page(user):
    universities = University.get_uni_list()
    profile = User.find_by_email(user)
    mypermissions = User.get_user_permissions(session['email'])
    permissions = [
        permission_level
        for permission_level in Database.find(Permissions.COLLECTION, {})
    ]
    return render_template('edit-profile.html',
                           user=user,
                           universities=universities,
                           profile=profile,
                           permissions=permissions,
                           mypermissions=mypermissions)
Beispiel #9
0
def populate_courses(university, college):
    college = University.get_college(university, college)
    courses = [course for course in college['courses']]
    return jsonify({"courses": courses})
Beispiel #10
0
def populate_colleges(university):
    university = University.get_uni(university)
    colleges = [college['name'] for college in university['colleges']]
    return jsonify({"colleges": colleges})
Beispiel #11
0
def edit_profile_page():
    universities = University.get_uni_list()
    profile = User.find_by_email(session['email'])
    return render_template('edit-profile.html', universities=universities, profile=profile)
Beispiel #12
0
def edit_profile_page():
    universities = University.get_uni_list()
    profile = User.find_by_email(session['email'])
    return render_template('edit-profile.html',
                           universities=universities,
                           profile=profile)
Beispiel #13
0
def remove_university(university):
    University.delete_university(university)
    return jsonify({"message": "OK"}), 200
Beispiel #14
0
def populate_courses(university, college):
    college = University.get_college(university, college)
    courses = [course for course in college['courses']]
    return jsonify({"courses": courses})
Beispiel #15
0
def populate_colleges(university):
    university = University.get_uni(university)
    colleges = [college['name'] for college in university['colleges']]
    return jsonify({"colleges": colleges})
Beispiel #16
0
def remove_course(university, college, course):
    University.delete_course(university, college, course)
    return jsonify({"message": "OK"}), 200
Beispiel #17
0
def remove_university(university):
    University.delete_university(university)
    return jsonify({"message": "OK"}), 200
Beispiel #18
0
def show_export_users():
    universities = University.get_uni_list()
    return render_template("user-export.html", universities=universities)
Beispiel #19
0
def remove_course(university, college, course):
    University.delete_course(university, college, course)
    return jsonify({"message": "OK"}), 200
Beispiel #20
0
def show_export_users():
    universities = University.get_uni_list()
    return render_template("user-export.html", universities=universities)