|
8 | 8 |
|
9 | 9 | from conditional.util.ldap import ldap_is_eval_director
|
10 | 10 | from conditional.util.ldap import ldap_get_member
|
| 11 | +from conditional.util.ldap import ldap_is_active |
11 | 12 | from conditional.util.flask import render_template
|
12 | 13 |
|
13 | 14 | from conditional import db, start_of_year
|
@@ -57,17 +58,21 @@ def submit_major_project():
|
57 | 58 |
|
58 | 59 | user_name = request.headers.get('x-webauth-user')
|
59 | 60 |
|
60 |
| - post_data = request.get_json() |
61 |
| - name = post_data['projectName'] |
62 |
| - description = post_data['projectDescription'] |
| 61 | + if ldap_is_active(user_name): |
| 62 | + post_data = request.get_json() |
| 63 | + name = post_data['projectName'] |
| 64 | + description = post_data['projectDescription'] |
63 | 65 |
|
64 |
| - if name == "" or description == "": |
65 |
| - return jsonify({"success": False}), 400 |
66 |
| - project = MajorProject(user_name, name, description) |
| 66 | + if name == "" or description == "": |
| 67 | + return jsonify({"success": False}), 400 |
| 68 | + project = MajorProject(user_name, name, description) |
67 | 69 |
|
68 |
| - db.session.add(project) |
69 |
| - db.session.commit() |
70 |
| - return jsonify({"success": True}), 200 |
| 70 | + db.session.add(project) |
| 71 | + db.session.commit() |
| 72 | + return jsonify({"success": True}), 200 |
| 73 | + else: |
| 74 | + # User is not an active member and does not need to complete a major project |
| 75 | + return jsonify({"success": False}, 403) |
71 | 76 |
|
72 | 77 |
|
73 | 78 | @major_project_bp.route('/major_project/review', methods=['POST'])
|
|
0 commit comments