From bd769fbfef95d98706bb902f1574be582526bcf6 Mon Sep 17 00:00:00 2001 From: EwoutV Date: Sat, 9 Mar 2024 13:05:39 +0100 Subject: [PATCH] fix: permission classes --- backend/api/permissions/course_permissions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/api/permissions/course_permissions.py b/backend/api/permissions/course_permissions.py index 7f88d7a9..5bce23e7 100644 --- a/backend/api/permissions/course_permissions.py +++ b/backend/api/permissions/course_permissions.py @@ -49,6 +49,8 @@ def has_object_permission(self, request: Request, view: ViewSet, course: Course) class CourseStudentPermission(CoursePermission): """Permission class for student related endpoints.""" + def has_permission(self, request: Request, view: ViewSet) -> bool: + return request.user and request.user.is_authenticated def has_object_permission(self, request: Request, view: ViewSet, course: Course): user: User = request.user @@ -67,6 +69,8 @@ def has_object_permission(self, request: Request, view: ViewSet, course: Course) class CourseProjectPermission(CoursePermission): """Permission class for project related endpoints.""" + def has_permission(self, request: Request, view: ViewSet) -> bool: + return request.user and request.user.is_authenticated def has_object_permission(self, request: Request, view: ViewSet, course: Course): user: User = request.user