mirror of https://github.com/jumpserver/jumpserver
20 lines
728 B
Python
20 lines
728 B
Python
from assets.models import AccountTemplate
|
|
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
|
|
|
from .base import AuthSerializerMixin
|
|
from .account import AccountSerializer
|
|
|
|
|
|
class AccountTemplateSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
|
|
class Meta:
|
|
model = AccountTemplate
|
|
fields_mini = ['id', 'privileged', 'username']
|
|
fields_write_only = AccountSerializer.Meta.fields_write_only
|
|
fields_other = AccountSerializer.Meta.fields_other
|
|
fields = fields_mini + fields_write_only + fields_other
|
|
extra_kwargs = AccountSerializer.Meta.extra_kwargs
|
|
|
|
def validate(self, attrs):
|
|
attrs = self._validate_gen_key(attrs)
|
|
return attrs
|