jumpserver/apps/ops/api/views.py

80 lines
2.1 KiB
Python
Raw Normal View History

2016-11-20 04:18:44 +00:00
# ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals
2016-11-24 14:34:55 +00:00
from rest_framework import viewsets
2016-11-20 04:18:44 +00:00
from serializers import *
from permissions import *
__all__ = ["HostAliaViewSet",
"CmdAliaViewSet",
"UserAliaViewSet",
"RunasAliaViewSet",
"ExtraconfViewSet",
"PrivilegeViewSet",
"SudoViewSet",
"CronTableViewSet",
"TaskViewSet",
2016-12-19 15:46:03 +00:00
"SubTaskViewSet",
]
2016-11-20 04:18:44 +00:00
2016-11-24 14:34:55 +00:00
class HostAliaViewSet(viewsets.ModelViewSet):
2016-11-20 04:18:44 +00:00
queryset = HostAlia.objects.all()
serializer_class = HostAliaSerializer
permission_classes = (AdminUserRequired,)
2016-11-20 04:18:44 +00:00
2016-11-24 14:34:55 +00:00
class CmdAliaViewSet(viewsets.ModelViewSet):
2016-11-20 04:18:44 +00:00
queryset = CmdAlia.objects.all()
serializer_class = CmdAliaSerializer
permission_classes = (AdminUserRequired,)
2016-11-20 04:18:44 +00:00
2016-11-24 14:34:55 +00:00
class UserAliaViewSet(viewsets.ModelViewSet):
2016-11-20 04:18:44 +00:00
queryset = UserAlia.objects.all()
serializer_class = UserAliaSerializer
permission_classes = (AdminUserRequired,)
2016-11-20 04:18:44 +00:00
2016-11-24 14:34:55 +00:00
class RunasAliaViewSet(viewsets.ModelViewSet):
2016-11-20 04:18:44 +00:00
queryset = RunasAlia.objects.all()
serializer_class = RunasAliaSerializer
permission_classes = (AdminUserRequired,)
2016-11-20 04:18:44 +00:00
2016-11-24 14:34:55 +00:00
class ExtraconfViewSet(viewsets.ModelViewSet):
2016-11-20 04:18:44 +00:00
queryset = Extra_conf.objects.all()
serializer_class = ExtraconfSerializer
permission_classes = (AdminUserRequired,)
2016-11-20 04:18:44 +00:00
2016-11-24 14:34:55 +00:00
class PrivilegeViewSet(viewsets.ModelViewSet):
2016-11-20 06:48:18 +00:00
queryset = Privilege.objects.all()
serializer_class = PrivilegeSerializer
permission_classes = (AdminUserRequired,)
2016-11-20 06:48:18 +00:00
2016-11-24 14:34:55 +00:00
class SudoViewSet(viewsets.ModelViewSet):
2016-11-20 06:48:18 +00:00
queryset = Sudo.objects.all()
serializer_class = SudoSerializer
permission_classes = (AdminUserRequired,)
2016-11-20 06:48:18 +00:00
2016-11-24 14:34:55 +00:00
class CronTableViewSet(viewsets.ModelViewSet):
queryset = CronTable.objects.all()
serializer_class = CronTableSerializer
permission_classes = (AdminUserRequired,)
class TaskViewSet(viewsets.ModelViewSet):
queryset = Task.objects.all()
serializer_class = TaskSerializer
permission_classes = (AdminUserRequired,)
2016-12-19 15:46:03 +00:00
class SubTaskViewSet(viewsets.ModelViewSet):
queryset = SubTask.objects.all()
serializer_class = SubTaskSerializer
permission_classes = (AdminUserRequired,)
2016-11-20 06:48:18 +00:00