Skip to content

Commit

Permalink
Merge pull request #69 from SELab-2/course-logic
Browse files Browse the repository at this point in the history
fix: course permissions
  • Loading branch information
BramMeir authored Mar 9, 2024
2 parents 19db3c7 + 3c5969a commit 52913a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/api/permissions/course_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def has_object_permission(self, request: Request, view: ViewSet, course: Course)
return user.is_authenticated

# Only students can add or remove themselves from a course.
if is_student(user) and request.data.get("id") == user.id:
if is_student(user) and request.data.get("student_id") == user.id:
return True

# Teachers and assistants can add and remove any student.
Expand Down
1 change: 1 addition & 0 deletions backend/api/views/course_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def clone(self, request: Request, **__):
try:
# We should return the already cloned course, if present
course = course.child_course

except Course.DoesNotExist:
# Else, we clone the course
course = course.clone(
Expand Down

0 comments on commit 52913a9

Please sign in to comment.