mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-29 21:51:31 +00:00
reactor: 重构命令&录像存储模块的Serializer及相关模块 (#5392)
* reactor: 重构命令&录像存储模块的Serializer及相关模块 Co-authored-by: Bai <bugatti_it@163.com>
This commit is contained in:
@@ -20,10 +20,10 @@ class BaseStorageViewSetMixin:
|
||||
|
||||
def destroy(self, request, *args, **kwargs):
|
||||
instance = self.get_object()
|
||||
if instance.in_defaults():
|
||||
if instance.type_null_or_server:
|
||||
data = {'msg': _('Deleting the default storage is not allowed')}
|
||||
return Response(data=data, status=status.HTTP_400_BAD_REQUEST)
|
||||
if instance.is_using():
|
||||
if instance.is_use():
|
||||
data = {'msg': _('Cannot delete storage that is being used')}
|
||||
return Response(data=data, status=status.HTTP_400_BAD_REQUEST)
|
||||
return super().destroy(request, *args, **kwargs)
|
||||
@@ -67,11 +67,9 @@ class BaseStorageTestConnectiveMixin:
|
||||
return Response(data)
|
||||
|
||||
|
||||
class CommandStorageTestConnectiveApi(BaseStorageTestConnectiveMixin,
|
||||
generics.RetrieveAPIView):
|
||||
class CommandStorageTestConnectiveApi(BaseStorageTestConnectiveMixin, generics.RetrieveAPIView):
|
||||
queryset = CommandStorage.objects.all()
|
||||
|
||||
|
||||
class ReplayStorageTestConnectiveApi(BaseStorageTestConnectiveMixin,
|
||||
generics.RetrieveAPIView):
|
||||
class ReplayStorageTestConnectiveApi(BaseStorageTestConnectiveMixin, generics.RetrieveAPIView):
|
||||
queryset = ReplayStorage.objects.all()
|
||||
|
||||
@@ -148,7 +148,5 @@ class TerminalConfig(APIView):
|
||||
permission_classes = (IsAppUser,)
|
||||
|
||||
def get(self, request):
|
||||
user = request.user
|
||||
terminal = user.terminal
|
||||
configs = terminal.config
|
||||
return Response(configs, status=200)
|
||||
config = request.user.terminal.config
|
||||
return Response(config, status=200)
|
||||
Reference in New Issue
Block a user