mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.0 KiB
35 lines
1.0 KiB
# -*- coding: utf-8 -*-
|
|
#
|
|
from accounts import serializers
|
|
from accounts.const import AutomationTypes
|
|
from accounts.models import GatherAccountsAutomation
|
|
from orgs.mixins.api import OrgBulkModelViewSet
|
|
from .base import AutomationExecutionViewSet
|
|
|
|
__all__ = [
|
|
'GatherAccountsAutomationViewSet', 'GatherAccountsExecutionViewSet'
|
|
]
|
|
|
|
|
|
class GatherAccountsAutomationViewSet(OrgBulkModelViewSet):
|
|
model = GatherAccountsAutomation
|
|
filter_fields = ('name',)
|
|
search_fields = filter_fields
|
|
ordering_fields = ('name',)
|
|
serializer_class = serializers.GatherAccountAutomationSerializer
|
|
|
|
|
|
class GatherAccountsExecutionViewSet(AutomationExecutionViewSet):
|
|
rbac_perms = (
|
|
("list", "accounts.view_gatheraccountsexecution"),
|
|
("retrieve", "accounts.view_gatheraccountsexecution"),
|
|
("create", "accounts.add_gatheraccountsexecution"),
|
|
)
|
|
|
|
tp = AutomationTypes.gather_accounts
|
|
|
|
def get_queryset(self):
|
|
queryset = super().get_queryset()
|
|
queryset = queryset.filter(automation__type=self.tp)
|
|
return queryset
|