mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-23 20:39:26 +00:00
@@ -4,6 +4,7 @@ from rest_framework import serializers
|
||||
from perms.serializers.base import ActionsField
|
||||
from perms.models import AssetPermission
|
||||
from orgs.utils import tmp_to_org
|
||||
from assets.models import Asset, Node
|
||||
|
||||
from tickets.models import ApplyAssetTicket
|
||||
from .ticket import TicketApplySerializer
|
||||
@@ -34,6 +35,12 @@ class ApplyAssetSerializer(BaseApplyAssetApplicationSerializer, TicketApplySeria
|
||||
}
|
||||
extra_kwargs.update(ticket_extra_kwargs)
|
||||
|
||||
def validate_apply_nodes(self, nodes):
|
||||
return self.filter_many_to_many_field(Node, nodes)
|
||||
|
||||
def validate_apply_assets(self, assets):
|
||||
return self.filter_many_to_many_field(Asset, assets)
|
||||
|
||||
def validate(self, attrs):
|
||||
attrs = super().validate(attrs)
|
||||
if not attrs.get('apply_nodes') and not attrs.get('apply_assets'):
|
||||
|
Reference in New Issue
Block a user