|
|
|
@ -1,5 +1,9 @@
|
|
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
|
|
|
from django.http import HttpResponse
|
|
|
|
|
from mixins.views import AbortSave, ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
|
|
|
|
|
from rest_framework import status
|
|
|
|
|
from rest_framework.parsers import JSONParser
|
|
|
|
|
from rest_framework.views import APIView
|
|
|
|
|
|
|
|
|
|
from core.forms import AssetGroupForm, AssetRestrictionForm
|
|
|
|
|
from core.models import AssetGroup, AssetRestriction
|
|
|
|
@ -99,3 +103,18 @@ class AssetRestrictionDelete(
|
|
|
|
|
LoginRequiredMixin, AssetRestrictionsPermissionMixin, ObjectDelete
|
|
|
|
|
):
|
|
|
|
|
model = AssetRestriction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AssetRestrictionAPI(APIView):
|
|
|
|
|
parser_classes = [JSONParser]
|
|
|
|
|
|
|
|
|
|
def post(self, request, webhook_id):
|
|
|
|
|
log.debug(f"AssetAPI POST {webhook_id}: {request.data}")
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
webhook = AssetRestriction.objects.get(webhook_id=webhook_id)
|
|
|
|
|
except AssetRestriction.DoesNotExist:
|
|
|
|
|
log.error(f"AssetRestriction {webhook_id} does not exist")
|
|
|
|
|
return HttpResponse(status=status.HTTP_404_NOT_FOUND)
|
|
|
|
|
|
|
|
|
|
return HttpResponse(status=status.HTTP_200_OK)
|
|
|
|
|