Merge pull request 'fix: allow all roles except 'user' on tech-passport endpoint' (#140) from behruz into main
All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 2m57s

Reviewed-on: #140
This commit is contained in:
2026-05-05 12:48:03 +00:00

View File

@@ -1,7 +1,7 @@
# rest framework
from rest_framework.response import Response
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.permissions import BasePermission
from rest_framework.generics import GenericAPIView
# swagger
@@ -10,11 +10,18 @@ from drf_spectacular.utils import extend_schema
# core apps
from core.services.tech_passport import TechPassportService
from core.apps.evaluation.serializers import TechPassportSerializer
from core.apps.accounts.choices import RoleChoice
class IsNotUserRole(BasePermission):
def has_permission(self, request, view):
if not request.user or not request.user.is_authenticated:
return False
return request.user.role != RoleChoice.USER
class TechPassportAPIView(GenericAPIView):
authentication_classes = []
permission_classes = [IsAuthenticated]
permission_classes = [IsNotUserRole]
@extend_schema(
tags=["Tech Passport"],