new kw for it services & sectors alignment & viewer access partial fixed

This commit is contained in:
IGNY8 VPS (Salman)
2026-02-20 23:29:51 +00:00
parent 2011e48145
commit 341f7c5bc7
110 changed files with 4768 additions and 36 deletions

View File

@@ -14,7 +14,7 @@ from django.utils.decorators import method_decorator
from drf_spectacular.utils import extend_schema, extend_schema_view
from igny8_core.api.base import SiteSectorModelViewSet
from igny8_core.api.permissions import IsAuthenticatedAndActive, IsEditorOrAbove
from igny8_core.api.permissions import IsAuthenticatedAndActive, IsEditorOrAbove, IsViewerOrAbove
from igny8_core.api.response import success_response, error_response
from igny8_core.api.throttles import DebugScopedRateThrottle
from igny8_core.business.publishing.models import PublishingRecord, DeploymentRecord
@@ -37,7 +37,12 @@ class PublishingRecordViewSet(SiteSectorModelViewSet):
permission_classes = [IsAuthenticatedAndActive, IsEditorOrAbove]
throttle_scope = 'publisher'
throttle_classes = [DebugScopedRateThrottle]
def get_permissions(self):
if self.action in ['list', 'retrieve']:
return [IsAuthenticatedAndActive(), IsViewerOrAbove()]
return [IsAuthenticatedAndActive(), IsEditorOrAbove()]
def get_serializer_class(self):
# Dynamically create serializer
from rest_framework import serializers
@@ -67,7 +72,12 @@ class DeploymentRecordViewSet(SiteSectorModelViewSet):
permission_classes = [IsAuthenticatedAndActive, IsEditorOrAbove]
throttle_scope = 'publisher'
throttle_classes = [DebugScopedRateThrottle]
def get_permissions(self):
if self.action in ['list', 'retrieve']:
return [IsAuthenticatedAndActive(), IsViewerOrAbove()]
return [IsAuthenticatedAndActive(), IsEditorOrAbove()]
def get_serializer_class(self):
# Dynamically create serializer
from rest_framework import serializers
@@ -89,6 +99,11 @@ class PublisherViewSet(viewsets.ViewSet):
permission_classes = [IsAuthenticatedAndActive, IsEditorOrAbove]
throttle_scope = 'publisher'
throttle_classes = [DebugScopedRateThrottle]
def get_permissions(self):
if self.action == 'get_status':
return [IsAuthenticatedAndActive(), IsViewerOrAbove()]
return [IsAuthenticatedAndActive(), IsEditorOrAbove()]
def __init__(self, **kwargs):
super().__init__(**kwargs)