mirror of
https://github.com/lemeow125/DocManagerBackend.git
synced 2025-04-19 00:11:32 +08:00
Compare commits
No commits in common. "84ff7011ea5f639545de7bc7c2ab7f7ea63f9f30" and "298501b97360dbee7c6df731ad75e8a25cb0a9d8" have entirely different histories.
84ff7011ea
...
298501b973
2 changed files with 2 additions and 9 deletions
|
@ -19,7 +19,7 @@ class IsPlanning(BasePermission):
|
|||
"""
|
||||
|
||||
def has_permission(self, request, view):
|
||||
return bool(request.user and request.user.role in ("planning", "admin", "head", "staff"))
|
||||
return bool(request.user and request.user.role in ("planning", "admin"))
|
||||
|
||||
|
||||
class IsHead(BasePermission):
|
||||
|
|
|
@ -15,14 +15,7 @@ class QuestionnaireListAPIView(generics.ListAPIView):
|
|||
serializer_class = QuestionnaireSerializer
|
||||
queryset = Questionnaire.objects.all()
|
||||
pagination_class = PageNumberPagination
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
def get_queryset(self):
|
||||
user = self.request.user
|
||||
if user.role == "client":
|
||||
return Questionnaire.objects.filter(client=user)
|
||||
else:
|
||||
return Questionnaire.objects.all()
|
||||
permission_classes = [IsAuthenticated, IsPlanning]
|
||||
|
||||
|
||||
class QuestionnaireSubmitView(generics.CreateAPIView):
|
||||
|
|
Loading…
Add table
Reference in a new issue