Fix is student permission and add viewsets for teachers and students for viewing transactions assigned to them

This commit is contained in:
Keannu Christian Bernasol 2023-12-21 14:57:42 +08:00
parent 938614fafa
commit d5dbe2b876
4 changed files with 65 additions and 2 deletions

View file

@ -25,7 +25,7 @@ class IsStudent(BasePermission):
message = "You must be a student to perform this action."
def has_permission(self, request, view):
return request.user.is_authenticated and request.user.is_student
return request.user.is_authenticated and (not request.user.is_teacher and not request.user.is_technician)
def has_object_permission(self, request, view, obj):
return request.user.is_authenticated and request.user.is_student
return request.user.is_authenticated and (not request.user.is_teacher and not request.user.is_technician)