new kw for it services & sectors alignment & viewer access partial fixed
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user