Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
added check on posting project
Browse files Browse the repository at this point in the history
  • Loading branch information
Vucis committed May 4, 2024
1 parent c665611 commit a1b7b1c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/project/endpoints/projects/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from project.utils.query_agent import create_model_instance
from project.utils.authentication import login_required_return_uid, authorize_teacher
from project.endpoints.projects.endpoint_parser import parse_project_params
from project.utils.models.course_utils import is_teacher_of_course
from project.utils.models.project_utils import get_course_of_project

API_URL = os.getenv('API_HOST')
Expand Down Expand Up @@ -80,8 +81,11 @@ def post(self, teacher_id=None):
Post functionality for project
using flask_restfull parse lib
"""

project_json = parse_project_params()

if not is_teacher_of_course(teacher_id, project_json["course_id"]):
return {"message":"You are not the teacher of this course"}, 403

filename = None
if "assignment_file" in request.files:
file = request.files["assignment_file"]
Expand Down

0 comments on commit a1b7b1c

Please sign in to comment.