new kw for it services & sectors alignment & viewer access partial fixed
This commit is contained in:
@@ -13,7 +13,7 @@ from rest_framework.views import APIView
|
||||
from django.shortcuts import get_object_or_404
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiParameter
|
||||
|
||||
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.auth.models import Site
|
||||
@@ -74,7 +74,13 @@ class UnifiedSiteSettingsViewSet(viewsets.ViewSet):
|
||||
permission_classes = [IsAuthenticatedAndActive, IsEditorOrAbove]
|
||||
throttle_scope = 'settings'
|
||||
throttle_classes = [DebugScopedRateThrottle]
|
||||
|
||||
|
||||
def get_permissions(self):
|
||||
"""Viewers can read settings; writes require editor+."""
|
||||
if self.action == 'retrieve':
|
||||
return [IsAuthenticatedAndActive(), IsViewerOrAbove()]
|
||||
return [IsAuthenticatedAndActive(), IsEditorOrAbove()]
|
||||
|
||||
def retrieve(self, request, site_id=None):
|
||||
"""Get all settings for a site in one response"""
|
||||
site = get_object_or_404(Site, id=site_id, account=request.user.account)
|
||||
|
||||
Reference in New Issue
Block a user