diff --git a/apps/assets/const.py b/apps/assets/const.py index 218657d22..64a928f16 100644 --- a/apps/assets/const.py +++ b/apps/assets/const.py @@ -9,15 +9,43 @@ __all__ = [ ] -class Category(models.TextChoices): +class PlatformMixin: + @classmethod + def platform_meta(cls): + return {} + + +class Category(PlatformMixin, models.TextChoices): HOST = 'host', _('Host') NETWORK = 'network', _("NetworkDevice") DATABASE = 'database', _("Database") REMOTE_APP = 'remote_app', _("Remote app") CLOUD = 'cloud', _("Clouding") + @classmethod + def platform_meta(cls): + return { + cls.HOST: { + 'has_domain': True, + 'protocols_limit': ['ssh', 'rdp', 'vnc', 'telnet'] + }, + cls.NETWORK: { + 'has_domain': True, + 'protocols_limit': ['ssh', 'telnet'] + }, + cls.DATABASE: { + 'has_domain': True + }, + cls.REMOTE_APP: { + 'has_domain': True + }, + cls.CLOUD: { + 'has_domain': False + } + } -class HostTypes(models.TextChoices): + +class HostTypes(PlatformMixin, models.TextChoices): LINUX = 'linux', 'Linux' WINDOWS = 'windows', 'Windows' UNIX = 'unix', 'Unix' @@ -26,15 +54,30 @@ class HostTypes(models.TextChoices): MAINFRAME = 'mainframe', _("Mainframe") OTHER_HOST = 'other_host', _("Other host") + @classmethod + def platform_meta(cls): + return {} -class NetworkTypes(models.TextChoices): + @classmethod + def get_default_port(cls): + defaults = { + cls.LINUX: 22, + cls.WINDOWS: 3389, + cls.UNIX: 22, + cls.BSD: 22, + cls.MACOS: 22, + cls.MAINFRAME: 22, + } + + +class NetworkTypes(PlatformMixin, models.TextChoices): SWITCH = 'switch', _("Switch") ROUTER = 'router', _("Router") FIREWALL = 'firewall', _("Firewall") OTHER_NETWORK = 'other_network', _("Other device") -class DatabaseTypes(models.TextChoices): +class DatabaseTypes(PlatformMixin, models.TextChoices): MYSQL = 'mysql', 'MySQL' MARIADB = 'mariadb', 'MariaDB' POSTGRESQL = 'postgresql', 'PostgreSQL' @@ -43,15 +86,23 @@ class DatabaseTypes(models.TextChoices): MONGODB = 'mongodb', 'MongoDB' REDIS = 'redis', 'Redis' + @classmethod + def platform_meta(cls): + meta = {} + for name, labal in cls.choices: + meta[name] = { + 'protocols_limit': [name] + } -class RemoteAppTypes(models.TextChoices): + +class RemoteAppTypes(PlatformMixin, models.TextChoices): CHROME = 'chrome', 'Chrome' VSPHERE = 'vmware_client', 'vSphere client' MYSQL_WORKBENCH = 'mysql_workbench', 'MySQL workbench' GENERAL_REMOTE_APP = 'general_remote_app', _("Custom") -class CloudTypes(models.TextChoices): +class CloudTypes(PlatformMixin, models.TextChoices): K8S = 'k8s', 'Kubernetes' @@ -62,15 +113,19 @@ class AllTypes(metaclass=IncludesTextChoicesMeta): RemoteAppTypes, CloudTypes ] + @classmethod + def category_types(cls): + return ( + (Category.HOST, HostTypes), + (Category.NETWORK, NetworkTypes), + (Category.DATABASE, DatabaseTypes), + (Category.REMOTE_APP, RemoteAppTypes), + (Category.CLOUD, CloudTypes) + ) + @classmethod def grouped_choices(cls): - grouped_types= [ - (Category.HOST.value, HostTypes.choices), - (Category.NETWORK.value, NetworkTypes.choices), - (Category.DATABASE.value, DatabaseTypes.choices), - (Category.REMOTE_APP.value, RemoteAppTypes.choices), - (Category.CLOUD.value, CloudTypes.choices), - ] + grouped_types = [(str(ca), tp.choices) for ca, tp in cls.category_types()] return grouped_types @classmethod @@ -88,7 +143,6 @@ class AllTypes(metaclass=IncludesTextChoicesMeta): return [dict(zip(title, choice)) for choice in choices] - class Protocol(models.TextChoices): ssh = 'ssh', 'SSH' rdp = 'rdp', 'RDP' @@ -116,3 +170,22 @@ class Protocol(models.TextChoices): cls.sqlserver, cls.redis, cls.mongodb, ] + @classmethod + def default_ports(cls): + return { + cls.ssh: 22, + cls.rdp: 3389, + cls.vnc: 5900, + cls.telnet: 21, + + cls.mysql: 3306, + cls.mariadb: 3306, + cls.postgresql: 5432, + cls.oracle: 1521, + cls.sqlserver: 1433, + cls.mongodb: 27017, + cls.redis: 6379, + + cls.k8s: 0 + } + diff --git a/apps/assets/migrations/0100_auto_20220430_2126.py b/apps/assets/migrations/0100_auto_20220430_2126.py new file mode 100644 index 000000000..bb2fc3b82 --- /dev/null +++ b/apps/assets/migrations/0100_auto_20220430_2126.py @@ -0,0 +1,54 @@ +# Generated by Django 3.1.14 on 2022-04-30 14:41 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('assets', '0099_auto_20220426_1558'), + ] + + operations = [ + migrations.AddField( + model_name='platform', + name='admin_user_default', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='assets.systemuser', verbose_name='Admin user default'), + ), + migrations.AddField( + model_name='platform', + name='admin_user_enabled', + field=models.BooleanField(default=True, verbose_name='Admin user enabled'), + ), + migrations.AddField( + model_name='platform', + name='domain_default', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='assets.domain', verbose_name='Domain default'), + ), + migrations.AddField( + model_name='platform', + name='domain_enabled', + field=models.BooleanField(default=True, verbose_name='Domain enabled'), + ), + migrations.AddField( + model_name='platform', + name='protocols_default', + field=models.CharField(blank=True, default='', max_length=128, verbose_name='Protocols default'), + ), + migrations.AddField( + model_name='platform', + name='protocols_enabled', + field=models.BooleanField(default=True, verbose_name='Protocols enabled'), + ), + migrations.AlterField( + model_name='asset', + name='category', + field=models.CharField(choices=[('host', 'Host'), ('network', 'NetworkDevice'), ('database', 'Database'), ('remote_app', 'Remote app'), ('cloud', 'Clouding')], max_length=16, verbose_name='Category'), + ), + migrations.AlterField( + model_name='platform', + name='category', + field=models.CharField(choices=[('host', 'Host'), ('network', 'NetworkDevice'), ('database', 'Database'), ('remote_app', 'Remote app'), ('cloud', 'Clouding')], max_length=16, verbose_name='Category'), + ), + ] diff --git a/apps/assets/models/platform.py b/apps/assets/models/platform.py index b3c9ec76e..04fcd3f68 100644 --- a/apps/assets/models/platform.py +++ b/apps/assets/models/platform.py @@ -20,6 +20,27 @@ class Platform(models.Model): meta = JsonDictTextField(blank=True, null=True, verbose_name=_("Meta")) internal = models.BooleanField(default=False, verbose_name=_("Internal")) comment = models.TextField(blank=True, null=True, verbose_name=_("Comment")) + domain_enabled = models.BooleanField(default=True, verbose_name=_("Domain enabled")) + domain_default = models.ForeignKey( + 'assets.Domain', null=True, on_delete=models.SET_NULL, + verbose_name=_("Domain default") + ) + protocols_enabled = models.BooleanField(default=True, verbose_name=_("Protocols enabled")) + protocols_default = models.CharField( + max_length=128, default='', blank=True, verbose_name=_("Protocols default") + ) + admin_user_enabled = models.BooleanField(default=True, verbose_name=_("Admin user enabled")) + admin_user_default = models.ForeignKey( + 'assets.SystemUser', null=True, on_delete=models.SET_NULL, + verbose_name=_("Admin user default") + ) + + def get_type_meta(self): + meta = Category.platform_meta().get(self.category, {}) + types = dict(AllTypes.category_types())[self.category] + type_meta = types.platform_meta().get(self.type, {}) + meta.update(type_meta) + return meta @classmethod def default(cls): diff --git a/apps/assets/serializers/asset/__init__.py b/apps/assets/serializers/asset/__init__.py index 51640e7cf..c6e5732be 100644 --- a/apps/assets/serializers/asset/__init__.py +++ b/apps/assets/serializers/asset/__init__.py @@ -1,2 +1,2 @@ from .common import * -from .host import * +from .category import * diff --git a/apps/assets/serializers/asset/category.py b/apps/assets/serializers/asset/category.py new file mode 100644 index 000000000..6d9ab1bf0 --- /dev/null +++ b/apps/assets/serializers/asset/category.py @@ -0,0 +1,68 @@ +from rest_framework import serializers +from django.utils.translation import gettext_lazy as _ + +from .common import AssetSerializer +from assets.models import DeviceInfo, Host, Database + +__all__ = [ + 'DeviceSerializer', 'HostSerializer', 'DatabaseSerializer' +] + + +class DeviceSerializer(serializers.ModelSerializer): + class Meta: + model = DeviceInfo + fields = [ + 'id', 'vendor', 'model', 'sn', 'cpu_model', 'cpu_count', + 'cpu_cores', 'cpu_vcpus', 'memory', 'disk_total', 'disk_info', + 'os', 'os_version', 'os_arch', 'hostname_raw', + 'cpu_info', 'hardware_info', 'date_updated' + ] + + +class HostSerializer(AssetSerializer): + device_info = DeviceSerializer(read_only=True, allow_null=True) + + class Meta(AssetSerializer.Meta): + model = Host + fields = AssetSerializer.Meta.fields + ['device_info'] + + +class DatabaseSerializer(AssetSerializer): + class Meta(AssetSerializer.Meta): + model = Database + fields_mini = [ + 'id', 'hostname', 'ip', 'port', 'db_name', + ] + fields_small = fields_mini + [ + 'is_active', 'comment', + ] + fields_fk = [ + 'domain', 'domain_display', 'platform', + ] + fields_m2m = [ + 'nodes', 'nodes_display', 'labels', 'labels_display', + ] + read_only_fields = [ + 'category', 'category_display', 'type', 'type_display', + 'created_by', 'date_created', + ] + fields = fields_small + fields_fk + fields_m2m + read_only_fields + extra_kwargs = { + **AssetSerializer.Meta.extra_kwargs, + 'db_name': {'required': True} + } + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + if not self.instance: + self.set_port_default() + + def set_port_default(self): + port = self.fields['port'] + type_port_mapper = { + 'mysql': 3306, + 'postgresql': 5432, + 'oracle': 22 + } + port.default = '' diff --git a/apps/assets/serializers/asset/common.py b/apps/assets/serializers/asset/common.py index 5092e53c2..2e4dd3fb9 100644 --- a/apps/assets/serializers/asset/common.py +++ b/apps/assets/serializers/asset/common.py @@ -3,8 +3,9 @@ from rest_framework import serializers from django.utils.translation import ugettext_lazy as _ -from orgs.mixins.serializers import BulkOrgResourceModelSerializer +from orgs.mixins.serializers import OrgResourceModelSerializerMixin from ...models import Asset, Node, Platform, SystemUser +from ..mixin import CategoryDisplayMixin __all__ = [ 'AssetSerializer', 'AssetSimpleSerializer', 'MiniAssetSerializer', @@ -56,17 +57,17 @@ class ProtocolsField(serializers.ListField): return value.split(' ') -class AssetSerializer(BulkOrgResourceModelSerializer): +class AssetSerializer(CategoryDisplayMixin, OrgResourceModelSerializerMixin): protocols = ProtocolsField(label=_('Protocols'), required=False, default=['ssh/22']) domain_display = serializers.ReadOnlyField(source='domain.name', label=_('Domain name')) nodes_display = serializers.ListField( child=serializers.CharField(), label=_('Nodes name'), required=False ) labels_display = serializers.ListField( - child=serializers.CharField(), label=_('Labels name'), required=False, read_only=True + child=serializers.CharField(), label=_('Labels name'), + required=False, read_only=True ) - category_display = serializers.ReadOnlyField(source='get_category_display', label=_("Category display")) - type_display = serializers.ReadOnlyField(source='get_type_display', label=_("Type display")) + platform_display = serializers.SlugField(source='platform.name', label=_("Platform display"), read_only=True) """ 资产的数据结构 @@ -75,27 +76,28 @@ class AssetSerializer(BulkOrgResourceModelSerializer): class Meta: model = Asset fields_mini = [ - 'id', 'category', 'category_display', 'type', 'type_display', - 'hostname', 'ip', 'platform', 'protocols' + 'id', 'hostname', 'ip', 'platform', 'protocols' ] fields_small = fields_mini + [ 'protocol', 'port', 'is_active', 'public_ip', 'number', 'comment', ] fields_fk = [ - 'domain', 'domain_display', 'platform', 'admin_user', 'admin_user_display' + 'domain', 'domain_display', 'platform', 'platform_display', + 'admin_user', 'admin_user_display' ] fields_m2m = [ 'nodes', 'nodes_display', 'labels', 'labels_display', ] read_only_fields = [ - 'connectivity', 'date_verified', 'created_by', 'date_created', - 'category', 'type' + 'category', 'category_display', 'type', 'type_display', + 'connectivity', 'date_verified', + 'created_by', 'date_created', ] fields = fields_small + fields_fk + fields_m2m + read_only_fields extra_kwargs = { 'hostname': {'label': _("Name")}, - 'ip': {'label': 'Address'}, + 'ip': {'label': _('IP/Host')}, 'protocol': {'write_only': True}, 'port': {'write_only': True}, 'admin_user_display': {'label': _('Admin user display'), 'read_only': True}, diff --git a/apps/assets/serializers/asset/host.py b/apps/assets/serializers/asset/host.py deleted file mode 100644 index 95606a866..000000000 --- a/apps/assets/serializers/asset/host.py +++ /dev/null @@ -1,31 +0,0 @@ -from rest_framework import serializers - -from .common import AssetSerializer -from assets.models import DeviceInfo, Host, Database - -__all__ = ['DeviceSerializer', 'HostSerializer', 'DatabaseSerializer'] - - -class DeviceSerializer(serializers.ModelSerializer): - class Meta: - model = DeviceInfo - fields = [ - 'id', 'vendor', 'model', 'sn', 'cpu_model', 'cpu_count', - 'cpu_cores', 'cpu_vcpus', 'memory', 'disk_total', 'disk_info', - 'os', 'os_version', 'os_arch', 'hostname_raw', - 'cpu_info', 'hardware_info', 'date_updated' - ] - - -class HostSerializer(AssetSerializer): - device_info = DeviceSerializer(read_only=True, allow_null=True) - - class Meta(AssetSerializer.Meta): - model = Host - fields = AssetSerializer.Meta.fields + ['device_info'] - - -class DatabaseSerializer(AssetSerializer): - class Meta(AssetSerializer.Meta): - model = Database - fields = AssetSerializer.Meta.fields + ['db_name'] diff --git a/apps/assets/serializers/mixin.py b/apps/assets/serializers/mixin.py new file mode 100644 index 000000000..45943dc2a --- /dev/null +++ b/apps/assets/serializers/mixin.py @@ -0,0 +1,11 @@ +from rest_framework import serializers +from django.utils.translation import gettext_lazy as _ + + +class CategoryDisplayMixin(serializers.Serializer): + category_display = serializers.ReadOnlyField( + source='get_category_display', label=_("Category display") + ) + type_display = serializers.ReadOnlyField( + source='get_type_display', label=_("Type display") + ) diff --git a/apps/assets/serializers/platform.py b/apps/assets/serializers/platform.py index b20348c14..078edee03 100644 --- a/apps/assets/serializers/platform.py +++ b/apps/assets/serializers/platform.py @@ -4,15 +4,13 @@ from django.utils.translation import gettext_lazy as _ from assets.models import Platform from assets.const import AllTypes +from .mixin import CategoryDisplayMixin __all__ = ['PlatformSerializer'] -class PlatformSerializer(serializers.ModelSerializer): - category_display = serializers.ReadOnlyField(source='get_category_display', label=_("Category display")) - type_display = serializers.ReadOnlyField(source='get_type_display', label=_("Type display")) +class PlatformSerializer(CategoryDisplayMixin, serializers.ModelSerializer): meta = serializers.DictField(required=False, allow_null=True, label=_('Meta')) - type = serializers.ChoiceField(choices=AllTypes.grouped_choices(), label=_("Type")) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -24,8 +22,19 @@ class PlatformSerializer(serializers.ModelSerializer): class Meta: model = Platform - fields = [ - 'id', 'name', 'category', 'category_display', - 'type', 'type_display', 'charset', - 'internal', 'meta', 'comment' + fields_mini = ['id', 'name', 'internal'] + fields_small = fields_mini + [ + 'meta', 'comment', 'charset', + 'category', 'category_display', 'type', 'type_display', ] + fields_fk = [ + 'domain_enabled', 'domain_default', + 'protocols_enabled', 'protocols_default', + 'admin_user_enabled', 'admin_user_default', + ] + fields = fields_small + fields_fk + read_only_fields = [ + 'category_display', 'type_display', + ] + + diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index 94187fd38..52b5027ef 100644 --- a/apps/locale/ja/LC_MESSAGES/django.po +++ b/apps/locale/ja/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-29 10:04+0800\n" +"POT-Creation-Date: 2022-04-30 22:42+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -27,11 +27,12 @@ msgstr "Acls" #: assets/models/cluster.py:18 assets/models/cmd_filter.py:27 #: assets/models/domain.py:23 assets/models/group.py:20 #: assets/models/label.py:18 assets/models/platform.py:16 -#: assets/models/protocol.py:8 ops/mixin.py:24 orgs/models.py:65 -#: perms/models/base.py:83 rbac/models/role.py:29 settings/models.py:29 -#: settings/serializers/sms.py:6 terminal/models/storage.py:23 -#: terminal/models/task.py:16 terminal/models/terminal.py:100 -#: users/forms/profile.py:32 users/models/group.py:15 users/models/user.py:659 +#: assets/models/protocol.py:8 assets/serializers/asset/common.py:99 +#: ops/mixin.py:24 orgs/models.py:65 perms/models/base.py:83 +#: rbac/models/role.py:29 settings/models.py:29 settings/serializers/sms.py:6 +#: terminal/models/storage.py:23 terminal/models/task.py:16 +#: terminal/models/terminal.py:100 users/forms/profile.py:32 +#: users/models/group.py:15 users/models/user.py:659 #: users/templates/users/_select_user_modal.html:13 #: users/templates/users/user_asset_permission.html:37 #: users/templates/users/user_asset_permission.html:154 @@ -264,17 +265,17 @@ msgstr "アプリケーション" #: applications/models/database.py:13 #: applications/serializers/attrs/application_category/db.py:14 #: applications/serializers/attrs/application_type/mysql_workbench.py:25 -#: assets/const.py:15 assets/models/asset/database.py:8 +#: assets/const.py:21 assets/models/asset/database.py:8 #: assets/models/asset/database.py:14 #: xpack/plugins/change_auth_plan/models/app.py:32 msgid "Database" msgstr "データベース" -#: applications/const.py:9 assets/const.py:16 +#: applications/const.py:9 assets/const.py:22 msgid "Remote app" msgstr "リモートアプリ" -#: applications/const.py:35 assets/const.py:51 +#: applications/const.py:35 assets/const.py:102 msgid "Custom" msgstr "カスタム" @@ -336,8 +337,7 @@ msgstr "カテゴリ" #: applications/serializers/application.py:101 #: assets/models/asset/common.py:131 assets/models/backup.py:49 #: assets/models/cmd_filter.py:82 assets/models/platform.py:18 -#: assets/models/user.py:234 assets/serializers/platform.py:15 -#: perms/models/application_permission.py:24 +#: assets/models/user.py:234 perms/models/application_permission.py:24 #: perms/serializers/application/user_permission.py:34 #: terminal/models/storage.py:55 terminal/models/storage.py:119 #: tickets/models/flow.py:56 tickets/models/ticket.py:131 @@ -364,7 +364,7 @@ msgstr "アプリケーションを一致させることができます" #: applications/models/database.py:8 #: applications/serializers/attrs/application_category/db.py:11 -#: assets/const.py:13 assets/models/asset/host.py:16 ops/models/adhoc.py:157 +#: assets/const.py:19 assets/models/asset/host.py:16 ops/models/adhoc.py:157 #: settings/serializers/auth/radius.py:14 #: xpack/plugins/cloud/serializers/account_attrs.py:68 msgid "Host" @@ -386,17 +386,14 @@ msgid "Port" msgstr "ポート" #: applications/serializers/application.py:70 -#: applications/serializers/application.py:100 -#: assets/serializers/asset/common.py:71 assets/serializers/label.py:13 -#: assets/serializers/platform.py:12 -#: perms/serializers/application/permission.py:18 +#: applications/serializers/application.py:100 assets/serializers/label.py:13 +#: assets/serializers/mixin.py:7 perms/serializers/application/permission.py:18 #: tickets/serializers/ticket/meta/ticket_type/apply_application.py:26 msgid "Category display" msgstr "カテゴリ表示" #: applications/serializers/application.py:71 -#: applications/serializers/application.py:102 -#: assets/serializers/asset/common.py:72 assets/serializers/platform.py:13 +#: applications/serializers/application.py:102 assets/serializers/mixin.py:10 #: assets/serializers/system_user.py:28 audits/serializers.py:29 #: perms/serializers/application/permission.py:19 #: tickets/serializers/ticket/meta/ticket_type/apply_application.py:33 @@ -527,53 +524,53 @@ msgstr "削除に失敗し、ノードにアセットが含まれています。 msgid "App assets" msgstr "アプリ資産" -#: assets/const.py:14 +#: assets/const.py:20 msgid "NetworkDevice" msgstr "" -#: assets/const.py:17 +#: assets/const.py:23 #, fuzzy #| msgid "Loading" msgid "Clouding" msgstr "読み込み中" -#: assets/const.py:26 +#: assets/const.py:54 msgid "Mainframe" msgstr "" -#: assets/const.py:27 +#: assets/const.py:55 #, fuzzy #| msgid "Other" msgid "Other host" msgstr "その他" -#: assets/const.py:31 +#: assets/const.py:74 #, fuzzy #| msgid "Switch from" msgid "Switch" msgstr "から切り替え" -#: assets/const.py:32 +#: assets/const.py:75 msgid "Router" msgstr "" -#: assets/const.py:33 +#: assets/const.py:76 msgid "Firewall" msgstr "" -#: assets/const.py:34 +#: assets/const.py:77 msgid "Other device" msgstr "" #: assets/models/asset/common.py:135 assets/serializers/account.py:16 -#: assets/serializers/asset/common.py:63 +#: assets/serializers/asset/common.py:61 #: perms/serializers/asset/user_permission.py:41 #: xpack/plugins/cloud/models.py:107 xpack/plugins/cloud/serializers/task.py:42 msgid "Protocols" msgstr "プロトコル" -#: assets/models/asset/common.py:137 assets/models/platform.py:41 -#: assets/serializers/account.py:15 assets/serializers/asset/common.py:61 +#: assets/models/asset/common.py:137 assets/models/platform.py:62 +#: assets/serializers/account.py:15 #: perms/serializers/asset/user_permission.py:43 msgid "Platform" msgstr "プラットフォーム" @@ -1044,7 +1041,7 @@ msgstr "ノードを一致させることができます" msgid "Charset" msgstr "シャーセット" -#: assets/models/platform.py:20 assets/serializers/platform.py:14 +#: assets/models/platform.py:20 assets/serializers/platform.py:13 #: tickets/models/ticket.py:133 msgid "Meta" msgstr "メタ" @@ -1053,6 +1050,42 @@ msgstr "メタ" msgid "Internal" msgstr "内部" +#: assets/models/platform.py:23 +#, fuzzy +#| msgid "Domain name" +msgid "Domain enabled" +msgstr "ドメイン名" + +#: assets/models/platform.py:26 +#, fuzzy +#| msgid "Default" +msgid "Domain default" +msgstr "デフォルト" + +#: assets/models/platform.py:28 +#, fuzzy +#| msgid "Protocols" +msgid "Protocols enabled" +msgstr "プロトコル" + +#: assets/models/platform.py:30 +#, fuzzy +#| msgid "Protocols" +msgid "Protocols default" +msgstr "プロトコル" + +#: assets/models/platform.py:32 +#, fuzzy +#| msgid "Admin user" +msgid "Admin user enabled" +msgstr "管理ユーザー" + +#: assets/models/platform.py:35 +#, fuzzy +#| msgid "Admin user display" +msgid "Admin user default" +msgstr "管理者ユーザー表示" + #: assets/models/user.py:217 msgid "Automatic managed" msgstr "自動管理" @@ -1158,27 +1191,39 @@ msgstr "" msgid "System user display" msgstr "システムユーザー表示" -#: assets/serializers/asset/common.py:18 +#: assets/serializers/asset/common.py:19 msgid "Protocol format should {}/{}" msgstr "プロトコル形式は {}/{}" -#: assets/serializers/asset/common.py:35 +#: assets/serializers/asset/common.py:36 msgid "Protocol duplicate: {}" msgstr "プロトコル重複: {}" -#: assets/serializers/asset/common.py:64 +#: assets/serializers/asset/common.py:62 msgid "Domain name" msgstr "ドメイン名" -#: assets/serializers/asset/common.py:66 +#: assets/serializers/asset/common.py:64 msgid "Nodes name" msgstr "ノード名" -#: assets/serializers/asset/common.py:69 +#: assets/serializers/asset/common.py:67 msgid "Labels name" msgstr "ラベル名" -#: assets/serializers/asset/common.py:102 +#: assets/serializers/asset/common.py:70 +#, fuzzy +#| msgid "Category display" +msgid "Platform display" +msgstr "カテゴリ表示" + +#: assets/serializers/asset/common.py:100 +#, fuzzy +#| msgid "Host" +msgid "IP/Host" +msgstr "ホスト" + +#: assets/serializers/asset/common.py:103 msgid "Admin user display" msgstr "管理者ユーザー表示" diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index 43655b79e..6d69faf53 100644 --- a/apps/locale/zh/LC_MESSAGES/django.mo +++ b/apps/locale/zh/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7326f6af4efae2abb098218faabe97aceed9a8f61dd5fcd56b16d5d07164556a -size 107769 +oid sha256:54c9c54a2e5ae5d27eb79f8ce0d19e7f362c016efb8c6011cace7bd2cb7eec1c +size 108123 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 9b235fcc3..da8f978d8 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: JumpServer 0.3.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-04-29 10:04+0800\n" +"POT-Creation-Date: 2022-04-30 22:42+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -26,11 +26,12 @@ msgstr "访问控制" #: assets/models/cluster.py:18 assets/models/cmd_filter.py:27 #: assets/models/domain.py:23 assets/models/group.py:20 #: assets/models/label.py:18 assets/models/platform.py:16 -#: assets/models/protocol.py:8 ops/mixin.py:24 orgs/models.py:65 -#: perms/models/base.py:83 rbac/models/role.py:29 settings/models.py:29 -#: settings/serializers/sms.py:6 terminal/models/storage.py:23 -#: terminal/models/task.py:16 terminal/models/terminal.py:100 -#: users/forms/profile.py:32 users/models/group.py:15 users/models/user.py:659 +#: assets/models/protocol.py:8 assets/serializers/asset/common.py:99 +#: ops/mixin.py:24 orgs/models.py:65 perms/models/base.py:83 +#: rbac/models/role.py:29 settings/models.py:29 settings/serializers/sms.py:6 +#: terminal/models/storage.py:23 terminal/models/task.py:16 +#: terminal/models/terminal.py:100 users/forms/profile.py:32 +#: users/models/group.py:15 users/models/user.py:659 #: users/templates/users/_select_user_modal.html:13 #: users/templates/users/user_asset_permission.html:37 #: users/templates/users/user_asset_permission.html:154 @@ -259,17 +260,17 @@ msgstr "应用管理" #: applications/models/database.py:13 #: applications/serializers/attrs/application_category/db.py:14 #: applications/serializers/attrs/application_type/mysql_workbench.py:25 -#: assets/const.py:15 assets/models/asset/database.py:8 +#: assets/const.py:21 assets/models/asset/database.py:8 #: assets/models/asset/database.py:14 #: xpack/plugins/change_auth_plan/models/app.py:32 msgid "Database" msgstr "数据库" -#: applications/const.py:9 assets/const.py:16 +#: applications/const.py:9 assets/const.py:22 msgid "Remote app" msgstr "远程应用" -#: applications/const.py:35 assets/const.py:51 +#: applications/const.py:35 assets/const.py:102 msgid "Custom" msgstr "自定义" @@ -331,8 +332,7 @@ msgstr "类别" #: applications/serializers/application.py:101 #: assets/models/asset/common.py:131 assets/models/backup.py:49 #: assets/models/cmd_filter.py:82 assets/models/platform.py:18 -#: assets/models/user.py:234 assets/serializers/platform.py:15 -#: perms/models/application_permission.py:24 +#: assets/models/user.py:234 perms/models/application_permission.py:24 #: perms/serializers/application/user_permission.py:34 #: terminal/models/storage.py:55 terminal/models/storage.py:119 #: tickets/models/flow.py:56 tickets/models/ticket.py:131 @@ -359,7 +359,7 @@ msgstr "匹配应用" #: applications/models/database.py:8 #: applications/serializers/attrs/application_category/db.py:11 -#: assets/const.py:13 assets/models/asset/host.py:16 ops/models/adhoc.py:157 +#: assets/const.py:19 assets/models/asset/host.py:16 ops/models/adhoc.py:157 #: settings/serializers/auth/radius.py:14 #: xpack/plugins/cloud/serializers/account_attrs.py:68 msgid "Host" @@ -381,17 +381,14 @@ msgid "Port" msgstr "端口" #: applications/serializers/application.py:70 -#: applications/serializers/application.py:100 -#: assets/serializers/asset/common.py:71 assets/serializers/label.py:13 -#: assets/serializers/platform.py:12 -#: perms/serializers/application/permission.py:18 +#: applications/serializers/application.py:100 assets/serializers/label.py:13 +#: assets/serializers/mixin.py:7 perms/serializers/application/permission.py:18 #: tickets/serializers/ticket/meta/ticket_type/apply_application.py:26 msgid "Category display" msgstr "类别名称" #: applications/serializers/application.py:71 -#: applications/serializers/application.py:102 -#: assets/serializers/asset/common.py:72 assets/serializers/platform.py:13 +#: applications/serializers/application.py:102 assets/serializers/mixin.py:10 #: assets/serializers/system_user.py:28 audits/serializers.py:29 #: perms/serializers/application/permission.py:19 #: tickets/serializers/ticket/meta/ticket_type/apply_application.py:33 @@ -522,47 +519,47 @@ msgstr "删除失败,节点包含资产" msgid "App assets" msgstr "资产管理" -#: assets/const.py:14 +#: assets/const.py:20 msgid "NetworkDevice" msgstr "网络设备" -#: assets/const.py:17 +#: assets/const.py:23 msgid "Clouding" msgstr "云设施" -#: assets/const.py:26 +#: assets/const.py:54 msgid "Mainframe" msgstr "大型机" -#: assets/const.py:27 +#: assets/const.py:55 msgid "Other host" msgstr "其它主机" -#: assets/const.py:31 +#: assets/const.py:74 msgid "Switch" msgstr "交换机" -#: assets/const.py:32 +#: assets/const.py:75 msgid "Router" msgstr "路由器" -#: assets/const.py:33 +#: assets/const.py:76 msgid "Firewall" msgstr "防火墙" -#: assets/const.py:34 +#: assets/const.py:77 msgid "Other device" msgstr "其它设备" #: assets/models/asset/common.py:135 assets/serializers/account.py:16 -#: assets/serializers/asset/common.py:63 +#: assets/serializers/asset/common.py:61 #: perms/serializers/asset/user_permission.py:41 #: xpack/plugins/cloud/models.py:107 xpack/plugins/cloud/serializers/task.py:42 msgid "Protocols" msgstr "协议组" -#: assets/models/asset/common.py:137 assets/models/platform.py:41 -#: assets/serializers/account.py:15 assets/serializers/asset/common.py:61 +#: assets/models/asset/common.py:137 assets/models/platform.py:62 +#: assets/serializers/account.py:15 #: perms/serializers/asset/user_permission.py:43 msgid "Platform" msgstr "系统平台" @@ -1031,7 +1028,7 @@ msgstr "可以匹配节点" msgid "Charset" msgstr "编码" -#: assets/models/platform.py:20 assets/serializers/platform.py:14 +#: assets/models/platform.py:20 assets/serializers/platform.py:13 #: tickets/models/ticket.py:133 msgid "Meta" msgstr "元数据" @@ -1040,6 +1037,30 @@ msgstr "元数据" msgid "Internal" msgstr "内部的" +#: assets/models/platform.py:23 +msgid "Domain enabled" +msgstr "启用网域" + +#: assets/models/platform.py:26 +msgid "Domain default" +msgstr "默认网域" + +#: assets/models/platform.py:28 +msgid "Protocols enabled" +msgstr "启用协议组" + +#: assets/models/platform.py:30 +msgid "Protocols default" +msgstr "默认协议组" + +#: assets/models/platform.py:32 +msgid "Admin user enabled" +msgstr "启用特权用户" + +#: assets/models/platform.py:35 +msgid "Admin user default" +msgstr "默认特权用户" + #: assets/models/user.py:217 msgid "Automatic managed" msgstr "托管密码" @@ -1142,27 +1163,37 @@ msgstr "" msgid "System user display" msgstr "系统用户名称" -#: assets/serializers/asset/common.py:18 +#: assets/serializers/asset/common.py:19 msgid "Protocol format should {}/{}" msgstr "协议格式 {}/{}" -#: assets/serializers/asset/common.py:35 +#: assets/serializers/asset/common.py:36 msgid "Protocol duplicate: {}" msgstr "协议重复: {}" -#: assets/serializers/asset/common.py:64 +#: assets/serializers/asset/common.py:62 msgid "Domain name" msgstr "网域名称" -#: assets/serializers/asset/common.py:66 +#: assets/serializers/asset/common.py:64 msgid "Nodes name" msgstr "节点名称" -#: assets/serializers/asset/common.py:69 +#: assets/serializers/asset/common.py:67 msgid "Labels name" msgstr "标签名称" -#: assets/serializers/asset/common.py:102 +#: assets/serializers/asset/common.py:70 +#, fuzzy +#| msgid "Category display" +msgid "Platform display" +msgstr "类别名称" + +#: assets/serializers/asset/common.py:100 +msgid "IP/Host" +msgstr "IP/主机" + +#: assets/serializers/asset/common.py:103 msgid "Admin user display" msgstr "特权用户名称"