jumpserver/apps/terminal/api/applet/host.py

24 lines
706 B
Python
Raw Normal View History

2022-10-25 04:57:34 +00:00
from rest_framework import viewsets
2022-10-27 08:26:15 +00:00
from orgs.utils import tmp_to_builtin_org
2022-10-25 04:57:34 +00:00
from terminal import serializers, models
__all__ = ['AppletHostViewSet', 'AppletHostDeploymentViewSet']
class AppletHostViewSet(viewsets.ModelViewSet):
serializer_class = serializers.AppletHostSerializer
2022-10-27 08:26:15 +00:00
def get_queryset(self):
return models.AppletHost.objects.all()
def dispatch(self, request, *args, **kwargs):
with tmp_to_builtin_org(system=1):
return super().dispatch(request, *args, **kwargs)
2022-10-25 11:31:13 +00:00
2022-10-25 04:57:34 +00:00
class AppletHostDeploymentViewSet(viewsets.ModelViewSet):
queryset = models.AppletHostDeployment.objects.all()
serializer_class = serializers.AppletHostDeploymentSerializer