Skip to content

Commit

Permalink
replace permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Dec 12, 2023
1 parent 181eb96 commit 9864ed5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions codeforlife/user/views/klass.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
from rest_framework.viewsets import ModelViewSet

from ..models import Class, User
from ..permissions import IsSchoolMember
from ..permissions import InSchool
from ..serializers import ClassSerializer


class ClassViewSet(ModelViewSet):
http_method_names = ["get"]
lookup_field = "access_code"
serializer_class = ClassSerializer
permission_classes = [IsAuthenticated, IsSchoolMember]
permission_classes = [IsAuthenticated, InSchool]

def get_queryset(self):
user: User = self.request.user
Expand Down
4 changes: 2 additions & 2 deletions codeforlife/user/views/school.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
from rest_framework.viewsets import ModelViewSet

from ..models import School, User
from ..permissions import IsSchoolMember
from ..permissions import InSchool
from ..serializers import SchoolSerializer


class SchoolViewSet(ModelViewSet):
http_method_names = ["get"]
serializer_class = SchoolSerializer
permission_classes = [IsAuthenticated, IsSchoolMember]
permission_classes = [IsAuthenticated, InSchool]

def get_queryset(self):
user: User = self.request.user
Expand Down

0 comments on commit 9864ed5

Please sign in to comment.