Browse Source

Remove IsStaff permission

Due to the duplication of IsAdminUser
pull/1658/head
Hironsan 2 years ago
parent
commit
9fb9481bcf
2 changed files with 2 additions and 11 deletions
  1. 8
      backend/api/permissions.py
  2. 5
      backend/api/views/project.py

8
backend/api/permissions.py

@ -1,8 +0,0 @@
from rest_framework.permissions import BasePermission
class IsStaff(BasePermission):
def has_permission(self, request, view):
if request.user.is_superuser or request.user.is_staff:
return True
return False

5
backend/api/views/project.py

@ -1,12 +1,11 @@
from django.conf import settings
from rest_framework import generics, status
from rest_framework.permissions import IsAuthenticated
from rest_framework.permissions import IsAdminUser, IsAuthenticated
from rest_framework.response import Response
from members.permissions import IsInProjectReadOnlyOrAdmin
from ..models import Project
from ..permissions import IsStaff
from ..serializers import ProjectPolymorphicSerializer
@ -18,7 +17,7 @@ class ProjectList(generics.ListCreateAPIView):
if self.request.method == 'GET':
self.permission_classes = [IsAuthenticated, ]
else:
self.permission_classes = [IsAuthenticated & IsStaff]
self.permission_classes = [IsAuthenticated & IsAdminUser]
return super().get_permissions()
def get_queryset(self):

Loading…
Cancel
Save