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
2 years ago
|
# -*- coding: utf-8 -*-
|
||
|
#
|
||
2 years ago
|
from accounts import serializers
|
||
|
from accounts.const import AutomationTypes
|
||
|
from accounts.models import GatherAccountsAutomation
|
||
2 years ago
|
from orgs.mixins.api import OrgBulkModelViewSet
|
||
|
from .base import AutomationExecutionViewSet
|
||
2 years ago
|
|
||
|
__all__ = [
|
||
2 years ago
|
'GatherAccountsAutomationViewSet', 'GatherAccountsExecutionViewSet'
|
||
2 years ago
|
]
|
||
|
|
||
|
|
||
|
class GatherAccountsAutomationViewSet(OrgBulkModelViewSet):
|
||
|
model = GatherAccountsAutomation
|
||
|
filter_fields = ('name',)
|
||
|
search_fields = filter_fields
|
||
|
ordering_fields = ('name',)
|
||
|
serializer_class = serializers.GatherAccountAutomationSerializer
|
||
2 years ago
|
|
||
|
|
||
|
class GatherAccountsExecutionViewSet(AutomationExecutionViewSet):
|
||
|
rbac_perms = (
|
||
2 years ago
|
("list", "accounts.view_gatheraccountsexecution"),
|
||
|
("retrieve", "accounts.view_gatheraccountsexecution"),
|
||
|
("create", "accounts.add_gatheraccountsexecution"),
|
||
2 years ago
|
)
|
||
2 years ago
|
|
||
|
tp = AutomationTypes.gather_accounts
|
||
|
|
||
|
def get_queryset(self):
|
||
|
queryset = super().get_queryset()
|
||
|
queryset = queryset.filter(automation__type=self.tp)
|
||
|
return queryset
|