mirror of https://github.com/jumpserver/jumpserver
parent
82222f9c23
commit
39f87c1c64
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.1.13 on 2024-11-12 06:35
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("accounts", "0010_accountrisk_details_alter_accountrisk_comment"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name="gatheredaccount",
|
||||
old_name="date_change_password",
|
||||
new_name="date_password_change",
|
||||
),
|
||||
]
|
@ -1,6 +1,5 @@
|
||||
from .account import *
|
||||
from .backup import *
|
||||
from .base import *
|
||||
from .gathered_account import *
|
||||
from .template import *
|
||||
from .virtual import *
|
||||
|
@ -1,42 +0,0 @@
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from accounts.models import GatheredAccount
|
||||
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
||||
from .account import AccountAssetSerializer as _AccountAssetSerializer
|
||||
from .base import BaseAccountSerializer
|
||||
|
||||
__all__ = [
|
||||
'GatheredAccountSerializer',
|
||||
'GatheredAccountActionSerializer',
|
||||
]
|
||||
|
||||
|
||||
class AccountAssetSerializer(_AccountAssetSerializer):
|
||||
class Meta(_AccountAssetSerializer.Meta):
|
||||
fields = [f for f in _AccountAssetSerializer.Meta.fields if f != 'auto_config']
|
||||
|
||||
|
||||
class GatheredAccountSerializer(BulkOrgResourceModelSerializer):
|
||||
asset = AccountAssetSerializer(label=_('Asset'))
|
||||
|
||||
class Meta(BaseAccountSerializer.Meta):
|
||||
model = GatheredAccount
|
||||
fields = [
|
||||
'id', 'asset', 'username',
|
||||
'date_updated', 'address_last_login',
|
||||
'groups', 'sudoers', 'authorized_keys',
|
||||
'remote_present', 'present',
|
||||
'date_last_login', 'status'
|
||||
]
|
||||
read_only_fields = fields
|
||||
|
||||
@classmethod
|
||||
def setup_eager_loading(cls, queryset):
|
||||
""" Perform necessary eager loading of data. """
|
||||
queryset = queryset.prefetch_related('asset', 'asset__platform')
|
||||
return queryset
|
||||
|
||||
|
||||
class GatheredAccountActionSerializer(GatheredAccountSerializer):
|
||||
class Meta(GatheredAccountSerializer.Meta):
|
||||
read_only_fields = list(set(GatheredAccountSerializer.Meta.read_only_fields) - {'status'})
|
Loading…
Reference in new issue