jumpserver/apps/ops/api/adhoc.py

26 lines
608 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2022-12-15 09:25:21 +00:00
from orgs.mixins.api import OrgBulkModelViewSet
2023-02-22 12:04:00 +00:00
from rbac.permissions import RBACPermission
2022-11-11 11:20:17 +00:00
from ..models import AdHoc
from ..serializers import (
2022-11-17 12:10:13 +00:00
AdHocSerializer
)
__all__ = [
2022-11-11 11:20:17 +00:00
'AdHocViewSet'
]
2022-12-15 09:25:21 +00:00
class AdHocViewSet(OrgBulkModelViewSet):
2022-11-17 12:10:13 +00:00
serializer_class = AdHocSerializer
2023-02-22 12:04:00 +00:00
permission_classes = (RBACPermission,)
2023-02-09 09:44:35 +00:00
search_fields = ('name', 'comment')
2022-12-06 09:30:54 +00:00
model = AdHoc
2022-12-15 09:25:21 +00:00
2022-12-21 09:14:07 +00:00
def allow_bulk_destroy(self, qs, filtered):
return True
2023-02-09 09:44:35 +00:00
2022-12-15 09:25:21 +00:00
def get_queryset(self):
queryset = super().get_queryset()
return queryset.filter(creator=self.request.user)