perf: 添加 check api 避免未认证

This commit is contained in:
ibuler
2023-09-13 17:05:01 +08:00
parent 1249935bab
commit d0f79c2df2
12 changed files with 189 additions and 40 deletions

View File

@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
#
from django.views.generic import TemplateView
from django.conf import settings
from django.http import HttpResponse
from django.views.generic import TemplateView
from common.views.mixins import PermissionsMixin
from rbac.permissions import RBACPermission
@@ -16,6 +17,11 @@ class CeleryTaskLogView(PermissionsMixin, TemplateView):
'GET': 'ops.view_celerytaskexecution'
}
def get(self, request, *args, **kwargs):
if not request.user.is_authenticated:
return HttpResponse(status=401)
return super().get(request, *args, **kwargs)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context.update({