diff --git a/apps/accounts/backends/base.py b/apps/accounts/backends/base.py index 12547a7cb..0af8e0167 100644 --- a/apps/accounts/backends/base.py +++ b/apps/accounts/backends/base.py @@ -43,7 +43,7 @@ class BaseVault(ABC): 'name', 'username', 'secret_type', 'connectivity', 'su_from', 'privileged' ]) - metadata = {field: str(value) for field, value in metadata.items()} + metadata = {k: str(v)[:500] for k, v in metadata.items() if v} return self._save_metadata(instance, metadata) # -------- abstractmethod -------- # diff --git a/apps/accounts/backends/hcp/main.py b/apps/accounts/backends/hcp/main.py index 9fb752c1b..53491e975 100644 --- a/apps/accounts/backends/hcp/main.py +++ b/apps/accounts/backends/hcp/main.py @@ -1,9 +1,12 @@ +from common.db.utils import get_logger from .entries import build_entry from .service import VaultKVClient from ..base import BaseVault __all__ = ['Vault'] +logger = get_logger(__name__) + class Vault(BaseVault): def __init__(self, *args, **kwargs): @@ -43,5 +46,8 @@ class Vault(BaseVault): instance.mark_secret_save_to_vault() def _save_metadata(self, instance, metadata): - entry = build_entry(instance) - self.client.update_metadata(path=entry.full_path, metadata=metadata) + try: + entry = build_entry(instance) + self.client.update_metadata(path=entry.full_path, metadata=metadata) + except Exception as e: + logger.error(f'save metadata error: {e}') diff --git a/apps/accounts/migrations/0013_account_backup_recipients.py b/apps/accounts/migrations/0013_account_backup_recipients.py index ac9956b76..6fe03e349 100644 --- a/apps/accounts/migrations/0013_account_backup_recipients.py +++ b/apps/accounts/migrations/0013_account_backup_recipients.py @@ -1,8 +1,9 @@ # Generated by Django 4.1.10 on 2023-08-03 08:28 - from django.conf import settings from django.db import migrations, models +import common.db.encoder + def migrate_recipients(apps, schema_editor): account_backup_model = apps.get_model('accounts', 'AccountBackupAutomation') @@ -13,13 +14,22 @@ def migrate_recipients(apps, schema_editor): continue account_backup.recipients_part_one.set(recipients) - execution_bojs = [] + objs = [] for execution in execution_model.objects.all(): snapshot = execution.snapshot recipients = snapshot.pop('recipients', {}) snapshot.update({'recipients_part_one': recipients, 'recipients_part_two': {}}) - execution_bojs.append(execution) - execution_model.objects.bulk_update(execution_bojs, ['snapshot']) + objs.append(execution) + execution_model.objects.bulk_update(objs, ['snapshot']) + + +def migrate_snapshot(apps, schema_editor): + model = apps.get_model('accounts', 'AccountBackupExecution') + objs = [] + for execution in model.objects.all(): + execution.snapshot = execution.plan_snapshot + objs.append(execution) + model.objects.bulk_update(objs, ['snapshot']) class Migration(migrations.Migration): @@ -45,12 +55,20 @@ class Migration(migrations.Migration): to=settings.AUTH_USER_MODEL, verbose_name='Recipient part two' ), ), - migrations.RenameField( + migrations.AddField( model_name='accountbackupexecution', - old_name='plan_snapshot', - new_name='snapshot', + name='snapshot', + field=models.JSONField( + default=dict, encoder=common.db.encoder.ModelJSONFieldEncoder, + null=True, blank=True, verbose_name='Account backup snapshot' + ), ), + migrations.RunPython(migrate_snapshot), migrations.RunPython(migrate_recipients), + migrations.RemoveField( + model_name='accountbackupexecution', + name='plan_snapshot', + ), migrations.RemoveField( model_name='accountbackupautomation', name='recipients', diff --git a/apps/accounts/models/automations/change_secret.py b/apps/accounts/models/automations/change_secret.py index a2a1d42a2..0efeff049 100644 --- a/apps/accounts/models/automations/change_secret.py +++ b/apps/accounts/models/automations/change_secret.py @@ -86,7 +86,7 @@ class ChangeSecretRecord(JMSBaseModel): asset = models.ForeignKey('assets.Asset', on_delete=models.CASCADE, null=True) account = models.ForeignKey('accounts.Account', on_delete=models.CASCADE, null=True) old_secret = fields.EncryptTextField(blank=True, null=True, verbose_name=_('Old secret')) - new_secret = fields.EncryptTextField(blank=True, null=True, verbose_name=_('Secret')) + new_secret = fields.EncryptTextField(blank=True, null=True, verbose_name=_('New secret')) date_started = models.DateTimeField(blank=True, null=True, verbose_name=_('Date started')) date_finished = models.DateTimeField(blank=True, null=True, verbose_name=_('Date finished')) status = models.CharField(max_length=16, default='pending') diff --git a/apps/accounts/models/mixins/vault.py b/apps/accounts/models/mixins/vault.py index e517516a9..b16927b62 100644 --- a/apps/accounts/models/mixins/vault.py +++ b/apps/accounts/models/mixins/vault.py @@ -52,17 +52,18 @@ class VaultModelMixin(models.Model): abstract = True # 缓存 secret 值, lazy-property 不能用 - __secret = False + __secret = None @property def secret(self): - if self.__secret is False: - from accounts.backends import vault_client - secret = vault_client.get(self) - if not secret and not self.secret_has_save_to_vault: - # vault_client 获取不到, 并且 secret 没有保存到 vault, 就从 self._secret 获取 - secret = self._secret - self.__secret = secret + if self.__secret: + return self.__secret + from accounts.backends import vault_client + secret = vault_client.get(self) + if not secret and not self.secret_has_save_to_vault: + # vault_client 获取不到, 并且 secret 没有保存到 vault, 就从 self._secret 获取 + secret = self._secret + self.__secret = secret return self.__secret @secret.setter @@ -72,6 +73,7 @@ class VaultModelMixin(models.Model): 先保存到 db, 再保存到 vault 同时删除本地 db _secret 值 """ self._secret = value + self.__secret = value _secret_save_to_vault_mark = '# Secret-has-been-saved-to-vault #' diff --git a/apps/accounts/tasks/vault.py b/apps/accounts/tasks/vault.py index a6c9ed6db..90e78cebf 100644 --- a/apps/accounts/tasks/vault.py +++ b/apps/accounts/tasks/vault.py @@ -1,4 +1,5 @@ -import datetime +from concurrent.futures import ThreadPoolExecutor, as_completed +from datetime import datetime from celery import shared_task from django.utils.translation import gettext_lazy as _ @@ -12,6 +13,22 @@ from ..const import VaultTypeChoices logger = get_logger(__name__) +def sync_instance(instance): + instance_desc = f'[{instance._meta.verbose_name}-{instance.id}-{instance}]' + if instance.secret_has_save_to_vault: + msg = f'\033[32m- 跳过同步: {instance_desc}, 原因: [已同步]' + return "skipped", msg + + try: + vault_client.create(instance) + except Exception as e: + msg = f'\033[31m- 同步失败: {instance_desc}, 原因: [{e}]' + return "failed", msg + else: + msg = f'\033[32m- 同步成功: {instance_desc}' + return "succeeded", msg + + @shared_task(verbose_name=_('Sync secret to vault')) def sync_secret_to_vault(): if vault_client.is_type(VaultTypeChoices.local): @@ -19,38 +36,34 @@ def sync_secret_to_vault(): print('\033[35m>>> 当前 Vault 类型为本地数据库, 不需要同步') return - print('\033[33m>>> 开始同步密钥数据到 Vault ({})'.format(datetime.datetime.now())) + failed, skipped, succeeded = 0, 0, 0 + to_sync_models = [Account, AccountTemplate, Account.history.model] + print(f'\033[33m>>> 开始同步密钥数据到 Vault ({datetime.now().strftime("%Y-%m-%d %H:%M:%S")})') with tmp_to_root_org(): - to_sync_models = [Account, AccountTemplate, Account.history.model] + instances = [] for model in to_sync_models: - print(f'\033[33m>>> 开始同步: {model.__module__}') - succeeded = [] - failed = [] - skipped = [] - instances = model.objects.all() - for instance in instances: - instance_desc = f'[{instance}]' - if instance.secret_has_save_to_vault: - print(f'\033[32m- 跳过同步: {instance_desc}, 原因: [已同步]') - skipped.append(instance) - continue - try: - vault_client.create(instance) - except Exception as e: - failed.append(instance) - print(f'\033[31m- 同步失败: {instance_desc}, 原因: [{e}]') - else: - succeeded.append(instance) - print(f'\033[32m- 同步成功: {instance_desc}') + instances += list(model.objects.all()) - total = len(succeeded) + len(failed) + len(skipped) - print( - f'\033[33m>>> 同步完成: {model.__module__}, ' - f'共计: {total}, ' - f'成功: {len(succeeded)}, ' - f'失败: {len(failed)}, ' - f'跳过: {len(skipped)}' - ) + with ThreadPoolExecutor(max_workers=10) as executor: + tasks = [executor.submit(sync_instance, instance) for instance in instances] - print('\033[33m>>> 全部同步完成 ({})'.format(datetime.datetime.now())) + for future in as_completed(tasks): + status, msg = future.result() + print(msg) + if status == "succeeded": + succeeded += 1 + elif status == "failed": + failed += 1 + elif status == "skipped": + skipped += 1 + + total = succeeded + failed + skipped + print( + f'\033[33m>>> 同步完成: {model.__module__}, ' + f'共计: {total}, ' + f'成功: {succeeded}, ' + f'失败: {failed}, ' + f'跳过: {skipped}' + ) + print(f'\033[33m>>> 全部同步完成 ({datetime.now().strftime("%Y-%m-%d %H:%M:%S")})') print('\033[0m') diff --git a/apps/assets/const/types.py b/apps/assets/const/types.py index afa0f6d05..8654002b9 100644 --- a/apps/assets/const/types.py +++ b/apps/assets/const/types.py @@ -224,7 +224,7 @@ class AllTypes(ChoicesMixin): return dict(id='ROOT', name=_('All types'), title=_('All types'), open=True, isParent=True) @classmethod - def get_tree_nodes(cls, resource_platforms, include_asset=False): + def get_tree_nodes(cls, resource_platforms, include_asset=False, get_root=True): from ..models import Platform platform_count = defaultdict(int) for platform_id in resource_platforms: @@ -239,10 +239,10 @@ class AllTypes(ChoicesMixin): category_type_mapper[p.category] += platform_count[p.id] tp_platforms[p.category + '_' + p.type].append(p) - nodes = [cls.get_root_nodes()] + nodes = [cls.get_root_nodes()] if get_root else [] for category, type_cls in cls.category_types(): # Category 格式化 - meta = {'type': 'category', 'category': category.value} + meta = {'type': 'category', 'category': category.value, '_type': category.value} category_node = cls.choice_to_node(category, 'ROOT', meta=meta) category_count = category_type_mapper.get(category, 0) category_node['name'] += f'({category_count})' diff --git a/apps/authentication/api/password.py b/apps/authentication/api/password.py index f1b245a46..86801bc6c 100644 --- a/apps/authentication/api/password.py +++ b/apps/authentication/api/password.py @@ -52,7 +52,11 @@ class UserResetPasswordSendCodeApi(CreateAPIView): other_args = {} target = serializer.validated_data[form_type] - query_key = 'phone' if form_type == 'sms' else form_type + if form_type == 'sms': + query_key = 'phone' + target = target.lstrip('+') + else: + query_key = form_type user, err = self.is_valid_user(username=username, **{query_key: target}) if not user: return Response({'error': err}, status=400) diff --git a/apps/authentication/backends/oidc/middleware.py b/apps/authentication/backends/oidc/middleware.py index c2ad33637..4481951e4 100644 --- a/apps/authentication/backends/oidc/middleware.py +++ b/apps/authentication/backends/oidc/middleware.py @@ -1,15 +1,14 @@ import time + import requests import requests.exceptions - -from django.core.exceptions import MiddlewareNotUsed from django.conf import settings from django.contrib import auth +from django.core.exceptions import MiddlewareNotUsed + from common.utils import get_logger - -from .utils import validate_and_return_id_token from .decorator import ssl_verification - +from .utils import validate_and_return_id_token logger = get_logger(__file__) @@ -25,11 +24,16 @@ class OIDCRefreshIDTokenMiddleware: def __call__(self, request): # Refreshes tokens only in the applicable cases. - if request.method == 'GET' and not request.is_ajax() and request.user.is_authenticated and settings.AUTH_OPENID: + if request.method == 'GET' and not self.is_ajax(request) and \ + request.user.is_authenticated and settings.AUTH_OPENID: self.refresh_token(request) response = self.get_response(request) return response + @staticmethod + def is_ajax(request): + return request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest' + @ssl_verification def refresh_token(self, request): """ Refreshes the token of the current user. """ diff --git a/apps/authentication/models/connection_token.py b/apps/authentication/models/connection_token.py index 29f0c28f1..6ea5474c4 100644 --- a/apps/authentication/models/connection_token.py +++ b/apps/authentication/models/connection_token.py @@ -191,7 +191,7 @@ class ConnectionToken(JMSOrgBaseModel): raise JMSException({'error': 'No host account available'}) host, account, lock_key, ttl = bulk_get(host_account, ('host', 'account', 'lock_key', 'ttl')) - gateway = host.gateway.select_gateway() if host.domain else None + gateway = host.domain.select_gateway() if host.domain else None data = { 'id': account.id, diff --git a/apps/common/sdk/im/feishu/__init__.py b/apps/common/sdk/im/feishu/__init__.py index 087a2fb88..99194e5c1 100644 --- a/apps/common/sdk/im/feishu/__init__.py +++ b/apps/common/sdk/im/feishu/__init__.py @@ -116,9 +116,13 @@ class FeiShu(RequestMixin): 'receive_id_type': 'user_id' } + """ + https://open.feishu.cn/document/common-capabilities/message-card/message-cards-content + /using-markdown-tags + """ body = { - 'msg_type': 'text', - 'content': json.dumps({'text': msg}) + 'msg_type': 'interactive', + 'content': json.dumps({'elements': [{'tag': 'markdown', 'content': msg}]}) } invalid_users = [] diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index 3578823b7..316a1c628 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: 2023-08-14 16:56+0800\n" +"POT-Creation-Date: 2023-08-10 18:22+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -213,7 +213,7 @@ msgstr "HashiCorp Vault" #: terminal/serializers/session.py:26 #: terminal/templates/terminal/_msg_command_warning.html:4 #: terminal/templates/terminal/_msg_session_sharing.html:4 -#: tickets/models/ticket/apply_asset.py:16 xpack/plugins/cloud/models.py:212 +#: tickets/models/ticket/apply_asset.py:16 xpack/plugins/cloud/models.py:253 msgid "Asset" msgstr "資産" @@ -248,7 +248,7 @@ msgstr "ソース ID" #: terminal/backends/command/models.py:18 terminal/models/session/session.py:33 #: terminal/templates/terminal/_msg_command_warning.html:8 #: terminal/templates/terminal/_msg_session_sharing.html:8 -#: tickets/models/ticket/command_confirm.py:13 xpack/plugins/cloud/models.py:85 +#: tickets/models/ticket/command_confirm.py:13 xpack/plugins/cloud/models.py:89 msgid "Account" msgstr "アカウント" @@ -315,7 +315,7 @@ msgid "Trigger mode" msgstr "トリガーモード" #: accounts/models/automations/backup_account.py:105 audits/models.py:194 -#: terminal/models/session/sharing.py:121 xpack/plugins/cloud/models.py:168 +#: terminal/models/session/sharing.py:121 xpack/plugins/cloud/models.py:205 msgid "Reason" msgstr "理由" @@ -376,7 +376,6 @@ msgid "Secret type" msgstr "鍵の種類" #: accounts/models/automations/change_secret.py:20 -#: accounts/models/automations/change_secret.py:89 #: accounts/models/mixins/vault.py:48 accounts/serializers/account/base.py:19 #: authentication/models/temp_token.py:10 #: authentication/templates/authentication/_access_key_modal.html:31 @@ -409,7 +408,11 @@ msgstr "自動暗号化" #: accounts/models/automations/change_secret.py:88 msgid "Old secret" -msgstr "以前のパスワード" +msgstr "オリジナルキー" + +#: accounts/models/automations/change_secret.py:89 +msgid "New secret" +msgstr "新しい鍵" #: accounts/models/automations/change_secret.py:90 msgid "Date started" @@ -511,7 +514,8 @@ msgstr "アカウントの確認" #: terminal/models/component/storage.py:26 terminal/models/component/task.py:13 #: terminal/models/component/terminal.py:84 users/forms/profile.py:33 #: users/models/group.py:13 users/models/user.py:787 -#: xpack/plugins/cloud/models.py:28 +#: xpack/plugins/cloud/models.py:32 xpack/plugins/cloud/models.py:273 +#: xpack/plugins/cloud/serializers/task.py:68 msgid "Name" msgstr "名前" @@ -528,7 +532,7 @@ msgstr "特権アカウント" msgid "Is active" msgstr "アクティブです。" -#: accounts/models/template.py:19 +#: accounts/models/template.py:19 xpack/plugins/cloud/models.py:325 msgid "Account template" msgstr "アカウント テンプレート" @@ -767,7 +771,7 @@ msgstr "" #: terminal/models/component/endpoint.py:104 #: terminal/models/session/session.py:46 tickets/models/comment.py:32 #: tickets/models/ticket/general.py:297 users/models/user.py:826 -#: xpack/plugins/cloud/models.py:35 xpack/plugins/cloud/models.py:111 +#: xpack/plugins/cloud/models.py:39 xpack/plugins/cloud/models.py:109 msgid "Comment" msgstr "コメント" @@ -888,11 +892,13 @@ msgstr "警告" #: acls/models/base.py:37 assets/models/_user.py:51 #: assets/models/cmd_filter.py:76 terminal/models/component/endpoint.py:97 +#: xpack/plugins/cloud/models.py:275 msgid "Priority" msgstr "優先順位" #: acls/models/base.py:38 assets/models/_user.py:51 #: assets/models/cmd_filter.py:76 terminal/models/component/endpoint.py:98 +#: xpack/plugins/cloud/models.py:276 msgid "1-100, the lower the value will be match first" msgstr "1-100、低い値は最初に一致します" @@ -929,6 +935,7 @@ msgid "Command" msgstr "コマンド" #: acls/models/command_acl.py:17 assets/models/cmd_filter.py:59 +#: xpack/plugins/cloud/models.py:291 msgid "Regex" msgstr "正規情報" @@ -1025,7 +1032,7 @@ msgid "None of the reviewers belong to Organization `{}`" msgstr "いずれのレビューアも組織 '{}' に属していません" #: acls/serializers/rules/rules.py:20 -#: xpack/plugins/cloud/serializers/task.py:22 +#: xpack/plugins/cloud/serializers/task.py:133 msgid "IP address invalid: `{}`" msgstr "IPアドレスが無効: '{}'" @@ -1053,7 +1060,7 @@ msgstr "期間" msgid "Applications" msgstr "アプリケーション" -#: applications/models.py:16 xpack/plugins/cloud/models.py:33 +#: applications/models.py:16 xpack/plugins/cloud/models.py:37 #: xpack/plugins/cloud/serializers/account.py:63 msgid "Attrs" msgstr "ツールバーの" @@ -1451,14 +1458,13 @@ msgstr "アドレス" #: assets/models/asset/common.py:151 assets/models/platform.py:119 #: authentication/serializers/connect_token_secret.py:115 -#: perms/serializers/user_permission.py:24 -#: xpack/plugins/cloud/serializers/account_attrs.py:196 +#: perms/serializers/user_permission.py:24 xpack/plugins/cloud/models.py:321 msgid "Platform" msgstr "プラットフォーム" #: assets/models/asset/common.py:153 assets/models/domain.py:21 #: authentication/serializers/connect_token_secret.py:133 -#: perms/serializers/user_permission.py:29 +#: perms/serializers/user_permission.py:29 xpack/plugins/cloud/models.py:323 msgid "Domain" msgstr "ドメイン" @@ -1534,8 +1540,8 @@ msgstr "アセットの自動化タスク" #: terminal/models/component/status.py:30 terminal/serializers/applet.py:18 #: terminal/serializers/applet_host.py:115 tickets/models/ticket/general.py:283 #: tickets/serializers/super_ticket.py:13 -#: tickets/serializers/ticket/ticket.py:20 xpack/plugins/cloud/models.py:164 -#: xpack/plugins/cloud/models.py:216 +#: tickets/serializers/ticket/ticket.py:20 xpack/plugins/cloud/models.py:201 +#: xpack/plugins/cloud/models.py:257 msgid "Status" msgstr "ステータス" @@ -1599,7 +1605,7 @@ msgstr "資産グループ" #: assets/models/group.py:31 assets/models/platform.py:19 #: assets/serializers/platform.py:113 -#: xpack/plugins/cloud/providers/nutanix.py:32 +#: xpack/plugins/cloud/providers/nutanix.py:30 msgid "Default" msgstr "デフォルト" @@ -1649,7 +1655,7 @@ msgid "Parent key" msgstr "親キー" #: assets/models/node.py:558 perms/serializers/permission.py:35 -#: tickets/models/ticket/apply_asset.py:14 xpack/plugins/cloud/models.py:96 +#: tickets/models/ticket/apply_asset.py:14 xpack/plugins/cloud/models.py:322 msgid "Node" msgstr "ノード" @@ -1790,7 +1796,8 @@ msgstr "" #: assets/serializers/asset/common.py:124 assets/serializers/platform.py:129 #: authentication/serializers/connect_token_secret.py:29 #: authentication/serializers/connect_token_secret.py:72 -#: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:99 +#: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:324 +#: xpack/plugins/cloud/serializers/task.py:31 msgid "Protocols" msgstr "プロトコル" @@ -3739,22 +3746,16 @@ msgid "Python" msgstr "Python" #: ops/const.py:52 -#, fuzzy -#| msgid "MySQL port" msgid "MySQL" -msgstr "MySQL ポート" +msgstr "MySQL" #: ops/const.py:53 -#, fuzzy -#| msgid "PostgreSQL port" msgid "PostgreSQL" -msgstr "PostgreSQL ポート" +msgstr "PostgreSQL" #: ops/const.py:54 -#, fuzzy -#| msgid "Server url" msgid "SQLServer" -msgstr "サービス側アドレス" +msgstr "SQLServer" #: ops/const.py:60 msgid "Timeout" @@ -3821,7 +3822,7 @@ msgid "Date last run" msgstr "最終実行日" #: ops/models/base.py:51 ops/models/job.py:217 -#: xpack/plugins/cloud/models.py:162 +#: xpack/plugins/cloud/models.py:199 msgid "Result" msgstr "結果" @@ -5172,10 +5173,8 @@ msgstr "" "はできません。" #: settings/serializers/security.py:39 -#, fuzzy -#| msgid "MFA not enabled" msgid "Not enabled" -msgstr "MFAが有効化されていません" +msgstr "有効化されていません" #: settings/serializers/security.py:40 msgid "All users" @@ -5904,22 +5903,16 @@ msgid "Risk level" msgstr "リスクレベル" #: terminal/connect_methods.py:29 -#, fuzzy -#| msgid "Client" msgid "SSH Client" -msgstr "クライアント" +msgstr "SSH クライアント" #: terminal/connect_methods.py:30 -#, fuzzy -#| msgid "SSH key" msgid "SSH Guide" -msgstr "SSH キー" +msgstr "SSH ガイド人" #: terminal/connect_methods.py:31 -#, fuzzy -#| msgid "Client" msgid "SFTP Client" -msgstr "クライアント" +msgstr "SFTP クライアント" #: terminal/connect_methods.py:33 msgid "DB Guide" @@ -5930,10 +5923,8 @@ msgid "DB Client" msgstr "データベース クライアント" #: terminal/connect_methods.py:36 -#, fuzzy -#| msgid "Remote Address" msgid "Remote Desktop" -msgstr "リモートアドレス" +msgstr "リモートデスクトップ" #: terminal/const.py:12 msgid "Review & Reject" @@ -6540,7 +6531,7 @@ msgstr "アクセスキー" msgid "Access key secret" msgstr "アクセスキーシークレット" -#: terminal/serializers/storage.py:67 xpack/plugins/cloud/models.py:209 +#: terminal/serializers/storage.py:67 xpack/plugins/cloud/models.py:250 msgid "Region" msgstr "リージョン" @@ -7102,7 +7093,7 @@ msgid "Not a valid ssh public key" msgstr "有効なssh公開鍵ではありません" #: users/forms/profile.py:173 users/models/user.py:820 -#: xpack/plugins/cloud/serializers/account_attrs.py:206 +#: xpack/plugins/cloud/serializers/account_attrs.py:203 msgid "Public key" msgstr "公開キー" @@ -7131,7 +7122,7 @@ msgid "OTP secret key" msgstr "OTP 秘密" #: users/models/user.py:817 -#: xpack/plugins/cloud/serializers/account_attrs.py:209 +#: xpack/plugins/cloud/serializers/account_attrs.py:206 msgid "Private key" msgstr "ssh秘密鍵" @@ -7570,11 +7561,11 @@ msgstr "パスワードの成功をリセットし、ログインページに戻 msgid "XPACK" msgstr "XPack" -#: xpack/plugins/cloud/api.py:38 +#: xpack/plugins/cloud/api.py:56 msgid "Test connection successful" msgstr "テスト接続成功" -#: xpack/plugins/cloud/api.py:40 +#: xpack/plugins/cloud/api.py:58 msgid "Test connection failed: {}" msgstr "テスト接続に失敗しました: {}" @@ -7662,7 +7653,7 @@ msgstr "プライベートIP" msgid "Public IP" msgstr "パブリックIP" -#: xpack/plugins/cloud/const.py:38 +#: xpack/plugins/cloud/const.py:38 xpack/plugins/cloud/models.py:295 msgid "Instance name" msgstr "インスタンス名" @@ -7690,78 +7681,158 @@ msgstr "同期済み" msgid "Released" msgstr "リリース済み" +#: xpack/plugins/cloud/manager.py:53 +msgid "Account unavailable" +msgstr "利用できないアカウント" + #: xpack/plugins/cloud/meta.py:9 msgid "Cloud center" msgstr "クラウドセンター" -#: xpack/plugins/cloud/models.py:30 +#: xpack/plugins/cloud/models.py:34 msgid "Provider" msgstr "プロバイダー" -#: xpack/plugins/cloud/models.py:34 +#: xpack/plugins/cloud/models.py:38 msgid "Validity" msgstr "有効性" -#: xpack/plugins/cloud/models.py:39 +#: xpack/plugins/cloud/models.py:43 msgid "Cloud account" msgstr "クラウドアカウント" -#: xpack/plugins/cloud/models.py:41 +#: xpack/plugins/cloud/models.py:45 msgid "Test cloud account" msgstr "クラウドアカウントのテスト" -#: xpack/plugins/cloud/models.py:88 xpack/plugins/cloud/serializers/task.py:36 +#: xpack/plugins/cloud/models.py:92 xpack/plugins/cloud/serializers/task.py:147 msgid "Regions" msgstr "リージョン" -#: xpack/plugins/cloud/models.py:91 +#: xpack/plugins/cloud/models.py:95 msgid "Hostname strategy" msgstr "ホスト名戦略" -#: xpack/plugins/cloud/models.py:102 xpack/plugins/cloud/serializers/task.py:39 +#: xpack/plugins/cloud/models.py:100 +#: xpack/plugins/cloud/serializers/task.py:150 msgid "IP network segment group" msgstr "IPネットワークセグメントグループ" -#: xpack/plugins/cloud/models.py:105 xpack/plugins/cloud/serializers/task.py:44 +#: xpack/plugins/cloud/models.py:103 +#: xpack/plugins/cloud/serializers/task.py:155 msgid "Sync IP type" msgstr "同期IPタイプ" -#: xpack/plugins/cloud/models.py:108 xpack/plugins/cloud/serializers/task.py:61 +#: xpack/plugins/cloud/models.py:106 +#: xpack/plugins/cloud/serializers/task.py:173 msgid "Always update" msgstr "常に更新" -#: xpack/plugins/cloud/models.py:114 +#: xpack/plugins/cloud/models.py:112 msgid "Date last sync" msgstr "最終同期日" -#: xpack/plugins/cloud/models.py:119 xpack/plugins/cloud/models.py:160 +#: xpack/plugins/cloud/models.py:115 xpack/plugins/cloud/models.py:313 +#: xpack/plugins/cloud/models.py:337 +msgid "Strategy" +msgstr "戦略" + +#: xpack/plugins/cloud/models.py:120 xpack/plugins/cloud/models.py:197 msgid "Sync instance task" msgstr "インスタンスの同期タスク" -#: xpack/plugins/cloud/models.py:171 xpack/plugins/cloud/models.py:219 +#: xpack/plugins/cloud/models.py:208 xpack/plugins/cloud/models.py:260 msgid "Date sync" msgstr "日付の同期" -#: xpack/plugins/cloud/models.py:175 +#: xpack/plugins/cloud/models.py:212 +msgid "Sync instance snapshot" +msgstr "インスタンススナップショットの同期" + +#: xpack/plugins/cloud/models.py:216 msgid "Sync instance task execution" msgstr "インスタンスタスクの同期実行" -#: xpack/plugins/cloud/models.py:199 +#: xpack/plugins/cloud/models.py:240 msgid "Sync task" msgstr "同期タスク" -#: xpack/plugins/cloud/models.py:203 +#: xpack/plugins/cloud/models.py:244 msgid "Sync instance task history" msgstr "インスタンスタスク履歴の同期" -#: xpack/plugins/cloud/models.py:206 +#: xpack/plugins/cloud/models.py:247 msgid "Instance" msgstr "インスタンス" -#: xpack/plugins/cloud/models.py:223 +#: xpack/plugins/cloud/models.py:264 msgid "Sync instance detail" msgstr "同期インスタンスの詳細" +#: xpack/plugins/cloud/models.py:281 +msgid "Task strategy" +msgstr "ミッション戦略です" + +#: xpack/plugins/cloud/models.py:285 +msgid "Exact" +msgstr "" + +#: xpack/plugins/cloud/models.py:286 +msgid "Not" +msgstr "否" + +#: xpack/plugins/cloud/models.py:287 +msgid "In" +msgstr "イン" + +#: xpack/plugins/cloud/models.py:288 +msgid "Contains" +msgstr "含む" + +#: xpack/plugins/cloud/models.py:289 +msgid "Startswith" +msgstr "始まる" + +#: xpack/plugins/cloud/models.py:290 +msgid "Endswith" +msgstr "終わる" + +#: xpack/plugins/cloud/models.py:296 +msgid "Instance platform" +msgstr "インスタンス名" + +#: xpack/plugins/cloud/models.py:297 +msgid "Instance address" +msgstr "インスタンスアドレス" + +#: xpack/plugins/cloud/models.py:304 +msgid "Rule attr" +msgstr "ルール属性" + +#: xpack/plugins/cloud/models.py:308 +msgid "Rule match" +msgstr "ルール一致" + +#: xpack/plugins/cloud/models.py:310 +msgid "Rule value" +msgstr "ルール値" + +#: xpack/plugins/cloud/models.py:317 +msgid "Strategy rule" +msgstr "戦略ルール" + +#: xpack/plugins/cloud/models.py:332 +msgid "Action attr" +msgstr "アクション属性" + +#: xpack/plugins/cloud/models.py:334 +msgid "Action value" +msgstr "アクション値" + +#: xpack/plugins/cloud/models.py:341 +msgid "Strategy action" +msgstr "戦略アクション" + #: xpack/plugins/cloud/providers/aws_international.py:18 msgid "China (Beijing)" msgstr "中国 (北京)" @@ -7870,7 +7941,7 @@ msgid "CN East-Suzhou" msgstr "華東-蘇州" #: xpack/plugins/cloud/providers/baiducloud.py:57 -#: xpack/plugins/cloud/providers/huaweicloud.py:50 +#: xpack/plugins/cloud/providers/huaweicloud.py:49 msgid "CN-Hong Kong" msgstr "中国-香港" @@ -7888,66 +7959,66 @@ msgid "CN East-Shanghai" msgstr "華東-上海" #: xpack/plugins/cloud/providers/baiducloud.py:61 -#: xpack/plugins/cloud/providers/huaweicloud.py:49 +#: xpack/plugins/cloud/providers/huaweicloud.py:51 msgid "AP-Singapore" msgstr "アジア太平洋-シンガポール" -#: xpack/plugins/cloud/providers/huaweicloud.py:37 -msgid "AF-Johannesburg" -msgstr "アフリカ-ヨハネスブルク" - -#: xpack/plugins/cloud/providers/huaweicloud.py:38 -msgid "CN North-Beijing4" -msgstr "華北-北京4" - #: xpack/plugins/cloud/providers/huaweicloud.py:39 msgid "CN North-Beijing1" msgstr "華北-北京1" #: xpack/plugins/cloud/providers/huaweicloud.py:40 -msgid "CN East-Shanghai2" -msgstr "華東-上海2" +msgid "CN North-Beijing4" +msgstr "華北-北京4" #: xpack/plugins/cloud/providers/huaweicloud.py:41 -msgid "CN East-Shanghai1" -msgstr "華東-上海1" - -#: xpack/plugins/cloud/providers/huaweicloud.py:43 -msgid "LA-Mexico City1" -msgstr "LA-メキシコCity1" - -#: xpack/plugins/cloud/providers/huaweicloud.py:44 -msgid "LA-Santiago" -msgstr "ラテンアメリカ-サンディエゴ" - -#: xpack/plugins/cloud/providers/huaweicloud.py:45 -msgid "LA-Sao Paulo1" -msgstr "ラミー・サンパウロ1" - -#: xpack/plugins/cloud/providers/huaweicloud.py:46 -msgid "EU-Paris" -msgstr "ヨーロッパ-パリ" - -#: xpack/plugins/cloud/providers/huaweicloud.py:47 -msgid "CN Southwest-Guiyang1" -msgstr "南西-貴陽1" - -#: xpack/plugins/cloud/providers/huaweicloud.py:48 -msgid "AP-Bangkok" -msgstr "アジア太平洋-バンコク" - -#: xpack/plugins/cloud/providers/huaweicloud.py:52 -msgid "CN Northeast-Dalian" -msgstr "华北-大连" - -#: xpack/plugins/cloud/providers/huaweicloud.py:53 msgid "CN North-Ulanqab1" msgstr "華北-ウランチャブ一" -#: xpack/plugins/cloud/providers/huaweicloud.py:54 +#: xpack/plugins/cloud/providers/huaweicloud.py:43 +msgid "CN South-Shenzhen" +msgstr "華南-広州" + +#: xpack/plugins/cloud/providers/huaweicloud.py:44 msgid "CN South-Guangzhou-InvitationOnly" msgstr "華南-広州-友好ユーザー環境" +#: xpack/plugins/cloud/providers/huaweicloud.py:45 +msgid "CN East-Shanghai2" +msgstr "華東-上海2" + +#: xpack/plugins/cloud/providers/huaweicloud.py:46 +msgid "CN East-Shanghai1" +msgstr "華東-上海1" + +#: xpack/plugins/cloud/providers/huaweicloud.py:48 +msgid "CN Southwest-Guiyang1" +msgstr "南西-貴陽1" + +#: xpack/plugins/cloud/providers/huaweicloud.py:50 +msgid "AP-Bangkok" +msgstr "アジア太平洋-バンコク" + +#: xpack/plugins/cloud/providers/huaweicloud.py:53 +msgid "AF-Johannesburg" +msgstr "アフリカ-ヨハネスブルク" + +#: xpack/plugins/cloud/providers/huaweicloud.py:54 +msgid "LA-Mexico City1" +msgstr "LA-メキシコCity1" + +#: xpack/plugins/cloud/providers/huaweicloud.py:55 +msgid "LA-Santiago" +msgstr "ラテンアメリカ-サンディエゴ" + +#: xpack/plugins/cloud/providers/huaweicloud.py:56 +msgid "LA-Sao Paulo1" +msgstr "ラミー・サンパウロ1" + +#: xpack/plugins/cloud/providers/huaweicloud.py:58 +msgid "TR-Istanbul" +msgstr "" + #: xpack/plugins/cloud/providers/jdcloud.py:126 msgid "CN East-Suqian" msgstr "華東-宿遷" @@ -7976,7 +8047,7 @@ msgstr "サブスクリプションID" #: xpack/plugins/cloud/serializers/account_attrs.py:103 #: xpack/plugins/cloud/serializers/account_attrs.py:119 #: xpack/plugins/cloud/serializers/account_attrs.py:149 -#: xpack/plugins/cloud/serializers/account_attrs.py:202 +#: xpack/plugins/cloud/serializers/account_attrs.py:199 msgid "API Endpoint" msgstr "APIエンドポイント" @@ -8042,11 +8113,11 @@ msgstr "テストポート" msgid "Test timeout" msgstr "テストタイムアウト" -#: xpack/plugins/cloud/serializers/account_attrs.py:212 +#: xpack/plugins/cloud/serializers/account_attrs.py:209 msgid "Project" msgstr "project" -#: xpack/plugins/cloud/serializers/task.py:28 +#: xpack/plugins/cloud/serializers/task.py:139 msgid "" "Only instances matching the IP range will be synced.
If the instance " "contains multiple IP addresses, the first IP address that matches will be " @@ -8060,11 +8131,11 @@ msgstr "" "ドレスをランダムに一致させることを意味します。
例: " "192.168.1.0/24,10.1.1.1-10.1.1.20。" -#: xpack/plugins/cloud/serializers/task.py:34 +#: xpack/plugins/cloud/serializers/task.py:145 msgid "History count" msgstr "実行回数" -#: xpack/plugins/cloud/serializers/task.py:35 +#: xpack/plugins/cloud/serializers/task.py:146 msgid "Instance count" msgstr "インスタンス数" @@ -8076,10 +8147,6 @@ msgstr "同期インスタンス タスクを実行する" msgid "Period clean sync instance task execution" msgstr "同期インスタンス タスクの実行記録を定期的にクリアする" -#: xpack/plugins/cloud/utils.py:68 -msgid "Account unavailable" -msgstr "利用できないアカウント" - #: xpack/plugins/interface/api.py:52 msgid "Restore default successfully." msgstr "デフォルトの復元に成功しました。" @@ -8144,9 +8211,6 @@ msgstr "究極のエディション" msgid "Community edition" msgstr "コミュニティ版" -#~ msgid "eg: http://dev.jumpserver.org:8080" -#~ msgstr "例えば: http://dev.jumpserver.org:8080" - #~ msgid "Strategy" #~ msgstr "戦略" @@ -8195,11 +8259,8 @@ msgstr "コミュニティ版" #~ msgid "Action value" #~ msgstr "アクション値" -#~ msgid "Strategy action" -#~ msgstr "戦略アクション" - -#~ msgid "CN South-Shenzhen" -#~ msgstr "華南-広州" +#~ msgid "CN Northeast-Dalian" +#~ msgstr "华北-大连" #~ msgid "Current only support login from AD/LDAP" #~ msgstr "現在、AD/LDAPからのログインのみサポートしています" diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 39125c86a..53b6b9c83 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: 2023-08-14 16:56+0800\n" +"POT-Creation-Date: 2023-08-10 18:22+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -212,7 +212,7 @@ msgstr "HashiCorp Vault" #: terminal/serializers/session.py:26 #: terminal/templates/terminal/_msg_command_warning.html:4 #: terminal/templates/terminal/_msg_session_sharing.html:4 -#: tickets/models/ticket/apply_asset.py:16 xpack/plugins/cloud/models.py:212 +#: tickets/models/ticket/apply_asset.py:16 xpack/plugins/cloud/models.py:253 msgid "Asset" msgstr "资产" @@ -247,7 +247,7 @@ msgstr "来源 ID" #: terminal/backends/command/models.py:18 terminal/models/session/session.py:33 #: terminal/templates/terminal/_msg_command_warning.html:8 #: terminal/templates/terminal/_msg_session_sharing.html:8 -#: tickets/models/ticket/command_confirm.py:13 xpack/plugins/cloud/models.py:85 +#: tickets/models/ticket/command_confirm.py:13 xpack/plugins/cloud/models.py:89 msgid "Account" msgstr "账号" @@ -314,7 +314,7 @@ msgid "Trigger mode" msgstr "触发模式" #: accounts/models/automations/backup_account.py:105 audits/models.py:194 -#: terminal/models/session/sharing.py:121 xpack/plugins/cloud/models.py:168 +#: terminal/models/session/sharing.py:121 xpack/plugins/cloud/models.py:205 msgid "Reason" msgstr "原因" @@ -375,7 +375,6 @@ msgid "Secret type" msgstr "密文类型" #: accounts/models/automations/change_secret.py:20 -#: accounts/models/automations/change_secret.py:89 #: accounts/models/mixins/vault.py:48 accounts/serializers/account/base.py:19 #: authentication/models/temp_token.py:10 #: authentication/templates/authentication/_access_key_modal.html:31 @@ -408,7 +407,11 @@ msgstr "自动化改密" #: accounts/models/automations/change_secret.py:88 msgid "Old secret" -msgstr "原密码" +msgstr "原密钥" + +#: accounts/models/automations/change_secret.py:89 +msgid "New secret" +msgstr "新密钥" #: accounts/models/automations/change_secret.py:90 msgid "Date started" @@ -510,7 +513,8 @@ msgstr "账号验证" #: terminal/models/component/storage.py:26 terminal/models/component/task.py:13 #: terminal/models/component/terminal.py:84 users/forms/profile.py:33 #: users/models/group.py:13 users/models/user.py:787 -#: xpack/plugins/cloud/models.py:28 +#: xpack/plugins/cloud/models.py:32 xpack/plugins/cloud/models.py:273 +#: xpack/plugins/cloud/serializers/task.py:68 msgid "Name" msgstr "名称" @@ -527,7 +531,7 @@ msgstr "特权账号" msgid "Is active" msgstr "激活" -#: accounts/models/template.py:19 +#: accounts/models/template.py:19 xpack/plugins/cloud/models.py:325 msgid "Account template" msgstr "账号模版" @@ -767,7 +771,7 @@ msgstr "" #: terminal/models/component/endpoint.py:104 #: terminal/models/session/session.py:46 tickets/models/comment.py:32 #: tickets/models/ticket/general.py:297 users/models/user.py:826 -#: xpack/plugins/cloud/models.py:35 xpack/plugins/cloud/models.py:111 +#: xpack/plugins/cloud/models.py:39 xpack/plugins/cloud/models.py:109 msgid "Comment" msgstr "备注" @@ -888,11 +892,13 @@ msgstr "告警" #: acls/models/base.py:37 assets/models/_user.py:51 #: assets/models/cmd_filter.py:76 terminal/models/component/endpoint.py:97 +#: xpack/plugins/cloud/models.py:275 msgid "Priority" msgstr "优先级" #: acls/models/base.py:38 assets/models/_user.py:51 #: assets/models/cmd_filter.py:76 terminal/models/component/endpoint.py:98 +#: xpack/plugins/cloud/models.py:276 msgid "1-100, the lower the value will be match first" msgstr "优先级可选范围为 1-100 (数值越小越优先)" @@ -929,6 +935,7 @@ msgid "Command" msgstr "命令" #: acls/models/command_acl.py:17 assets/models/cmd_filter.py:59 +#: xpack/plugins/cloud/models.py:291 msgid "Regex" msgstr "正则表达式" @@ -1024,7 +1031,7 @@ msgid "None of the reviewers belong to Organization `{}`" msgstr "所有复核人都不属于组织 `{}`" #: acls/serializers/rules/rules.py:20 -#: xpack/plugins/cloud/serializers/task.py:22 +#: xpack/plugins/cloud/serializers/task.py:133 msgid "IP address invalid: `{}`" msgstr "IP 地址无效: `{}`" @@ -1052,7 +1059,7 @@ msgstr "时段" msgid "Applications" msgstr "应用管理" -#: applications/models.py:16 xpack/plugins/cloud/models.py:33 +#: applications/models.py:16 xpack/plugins/cloud/models.py:37 #: xpack/plugins/cloud/serializers/account.py:63 msgid "Attrs" msgstr "属性" @@ -1449,14 +1456,13 @@ msgstr "地址" #: assets/models/asset/common.py:151 assets/models/platform.py:119 #: authentication/serializers/connect_token_secret.py:115 -#: perms/serializers/user_permission.py:24 -#: xpack/plugins/cloud/serializers/account_attrs.py:196 +#: perms/serializers/user_permission.py:24 xpack/plugins/cloud/models.py:321 msgid "Platform" msgstr "系统平台" #: assets/models/asset/common.py:153 assets/models/domain.py:21 #: authentication/serializers/connect_token_secret.py:133 -#: perms/serializers/user_permission.py:29 +#: perms/serializers/user_permission.py:29 xpack/plugins/cloud/models.py:323 msgid "Domain" msgstr "网域" @@ -1532,8 +1538,8 @@ msgstr "资产自动化任务" #: terminal/models/component/status.py:30 terminal/serializers/applet.py:18 #: terminal/serializers/applet_host.py:115 tickets/models/ticket/general.py:283 #: tickets/serializers/super_ticket.py:13 -#: tickets/serializers/ticket/ticket.py:20 xpack/plugins/cloud/models.py:164 -#: xpack/plugins/cloud/models.py:216 +#: tickets/serializers/ticket/ticket.py:20 xpack/plugins/cloud/models.py:201 +#: xpack/plugins/cloud/models.py:257 msgid "Status" msgstr "状态" @@ -1597,7 +1603,7 @@ msgstr "资产组" #: assets/models/group.py:31 assets/models/platform.py:19 #: assets/serializers/platform.py:113 -#: xpack/plugins/cloud/providers/nutanix.py:32 +#: xpack/plugins/cloud/providers/nutanix.py:30 msgid "Default" msgstr "默认" @@ -1647,7 +1653,7 @@ msgid "Parent key" msgstr "ssh私钥" #: assets/models/node.py:558 perms/serializers/permission.py:35 -#: tickets/models/ticket/apply_asset.py:14 xpack/plugins/cloud/models.py:96 +#: tickets/models/ticket/apply_asset.py:14 xpack/plugins/cloud/models.py:322 msgid "Node" msgstr "节点" @@ -1786,7 +1792,8 @@ msgstr "资产中批量更新平台,不符合平台类型跳过的资产" #: assets/serializers/asset/common.py:124 assets/serializers/platform.py:129 #: authentication/serializers/connect_token_secret.py:29 #: authentication/serializers/connect_token_secret.py:72 -#: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:99 +#: perms/serializers/user_permission.py:25 xpack/plugins/cloud/models.py:324 +#: xpack/plugins/cloud/serializers/task.py:31 msgid "Protocols" msgstr "协议组" @@ -3773,7 +3780,7 @@ msgid "Date last run" msgstr "最后运行日期" #: ops/models/base.py:51 ops/models/job.py:217 -#: xpack/plugins/cloud/models.py:162 +#: xpack/plugins/cloud/models.py:199 msgid "Result" msgstr "结果" @@ -6416,7 +6423,7 @@ msgstr "Access key ID(AK)" msgid "Access key secret" msgstr "Access key secret(SK)" -#: terminal/serializers/storage.py:67 xpack/plugins/cloud/models.py:209 +#: terminal/serializers/storage.py:67 xpack/plugins/cloud/models.py:250 msgid "Region" msgstr "地域" @@ -6972,7 +6979,7 @@ msgid "Not a valid ssh public key" msgstr "SSH密钥不合法" #: users/forms/profile.py:173 users/models/user.py:820 -#: xpack/plugins/cloud/serializers/account_attrs.py:206 +#: xpack/plugins/cloud/serializers/account_attrs.py:203 msgid "Public key" msgstr "SSH公钥" @@ -7001,7 +7008,7 @@ msgid "OTP secret key" msgstr "OTP 密钥" #: users/models/user.py:817 -#: xpack/plugins/cloud/serializers/account_attrs.py:209 +#: xpack/plugins/cloud/serializers/account_attrs.py:206 msgid "Private key" msgstr "ssh私钥" @@ -7427,11 +7434,11 @@ msgstr "重置密码成功,返回到登录页面" msgid "XPACK" msgstr "XPack" -#: xpack/plugins/cloud/api.py:38 +#: xpack/plugins/cloud/api.py:56 msgid "Test connection successful" msgstr "测试成功" -#: xpack/plugins/cloud/api.py:40 +#: xpack/plugins/cloud/api.py:58 msgid "Test connection failed: {}" msgstr "测试连接失败:{}" @@ -7519,7 +7526,7 @@ msgstr "私有IP" msgid "Public IP" msgstr "公网IP" -#: xpack/plugins/cloud/const.py:38 +#: xpack/plugins/cloud/const.py:38 xpack/plugins/cloud/models.py:295 msgid "Instance name" msgstr "实例名称" @@ -7547,78 +7554,158 @@ msgstr "已同步" msgid "Released" msgstr "已释放" +#: xpack/plugins/cloud/manager.py:53 +msgid "Account unavailable" +msgstr "账号无效" + #: xpack/plugins/cloud/meta.py:9 msgid "Cloud center" msgstr "云管中心" -#: xpack/plugins/cloud/models.py:30 +#: xpack/plugins/cloud/models.py:34 msgid "Provider" msgstr "云服务商" -#: xpack/plugins/cloud/models.py:34 +#: xpack/plugins/cloud/models.py:38 msgid "Validity" msgstr "有效" -#: xpack/plugins/cloud/models.py:39 +#: xpack/plugins/cloud/models.py:43 msgid "Cloud account" msgstr "云账号" -#: xpack/plugins/cloud/models.py:41 +#: xpack/plugins/cloud/models.py:45 msgid "Test cloud account" msgstr "测试云账号" -#: xpack/plugins/cloud/models.py:88 xpack/plugins/cloud/serializers/task.py:36 +#: xpack/plugins/cloud/models.py:92 xpack/plugins/cloud/serializers/task.py:147 msgid "Regions" msgstr "地域" -#: xpack/plugins/cloud/models.py:91 +#: xpack/plugins/cloud/models.py:95 msgid "Hostname strategy" msgstr "主机名策略" -#: xpack/plugins/cloud/models.py:102 xpack/plugins/cloud/serializers/task.py:39 +#: xpack/plugins/cloud/models.py:100 +#: xpack/plugins/cloud/serializers/task.py:150 msgid "IP network segment group" msgstr "IP网段组" -#: xpack/plugins/cloud/models.py:105 xpack/plugins/cloud/serializers/task.py:44 +#: xpack/plugins/cloud/models.py:103 +#: xpack/plugins/cloud/serializers/task.py:155 msgid "Sync IP type" msgstr "同步IP类型" -#: xpack/plugins/cloud/models.py:108 xpack/plugins/cloud/serializers/task.py:61 +#: xpack/plugins/cloud/models.py:106 +#: xpack/plugins/cloud/serializers/task.py:173 msgid "Always update" msgstr "总是更新" -#: xpack/plugins/cloud/models.py:114 +#: xpack/plugins/cloud/models.py:112 msgid "Date last sync" msgstr "最后同步日期" -#: xpack/plugins/cloud/models.py:119 xpack/plugins/cloud/models.py:160 +#: xpack/plugins/cloud/models.py:115 xpack/plugins/cloud/models.py:313 +#: xpack/plugins/cloud/models.py:337 +msgid "Strategy" +msgstr "策略" + +#: xpack/plugins/cloud/models.py:120 xpack/plugins/cloud/models.py:197 msgid "Sync instance task" msgstr "同步实例任务" -#: xpack/plugins/cloud/models.py:171 xpack/plugins/cloud/models.py:219 +#: xpack/plugins/cloud/models.py:208 xpack/plugins/cloud/models.py:260 msgid "Date sync" msgstr "同步日期" -#: xpack/plugins/cloud/models.py:175 +#: xpack/plugins/cloud/models.py:212 +msgid "Sync instance snapshot" +msgstr "同步实例快照" + +#: xpack/plugins/cloud/models.py:216 msgid "Sync instance task execution" msgstr "同步实例任务执行" -#: xpack/plugins/cloud/models.py:199 +#: xpack/plugins/cloud/models.py:240 msgid "Sync task" msgstr "同步任务" -#: xpack/plugins/cloud/models.py:203 +#: xpack/plugins/cloud/models.py:244 msgid "Sync instance task history" msgstr "同步实例任务历史" -#: xpack/plugins/cloud/models.py:206 +#: xpack/plugins/cloud/models.py:247 msgid "Instance" msgstr "实例" -#: xpack/plugins/cloud/models.py:223 +#: xpack/plugins/cloud/models.py:264 msgid "Sync instance detail" msgstr "同步实例详情" +#: xpack/plugins/cloud/models.py:281 +msgid "Task strategy" +msgstr "任务策略" + +#: xpack/plugins/cloud/models.py:285 +msgid "Exact" +msgstr "" + +#: xpack/plugins/cloud/models.py:286 +msgid "Not" +msgstr "否" + +#: xpack/plugins/cloud/models.py:287 +msgid "In" +msgstr "在..里面" + +#: xpack/plugins/cloud/models.py:288 +msgid "Contains" +msgstr "包含" + +#: xpack/plugins/cloud/models.py:289 +msgid "Startswith" +msgstr "以..开头" + +#: xpack/plugins/cloud/models.py:290 +msgid "Endswith" +msgstr "以..结尾" + +#: xpack/plugins/cloud/models.py:296 +msgid "Instance platform" +msgstr "实例平台" + +#: xpack/plugins/cloud/models.py:297 +msgid "Instance address" +msgstr "实例地址" + +#: xpack/plugins/cloud/models.py:304 +msgid "Rule attr" +msgstr "规则属性" + +#: xpack/plugins/cloud/models.py:308 +msgid "Rule match" +msgstr "规则匹配" + +#: xpack/plugins/cloud/models.py:310 +msgid "Rule value" +msgstr "规则值" + +#: xpack/plugins/cloud/models.py:317 +msgid "Strategy rule" +msgstr "策略规则" + +#: xpack/plugins/cloud/models.py:332 +msgid "Action attr" +msgstr "动作属性" + +#: xpack/plugins/cloud/models.py:334 +msgid "Action value" +msgstr "动作值" + +#: xpack/plugins/cloud/models.py:341 +msgid "Strategy action" +msgstr "策略动作" + #: xpack/plugins/cloud/providers/aws_international.py:18 msgid "China (Beijing)" msgstr "中国 (北京)" @@ -7727,7 +7814,7 @@ msgid "CN East-Suzhou" msgstr "华东-苏州" #: xpack/plugins/cloud/providers/baiducloud.py:57 -#: xpack/plugins/cloud/providers/huaweicloud.py:50 +#: xpack/plugins/cloud/providers/huaweicloud.py:49 msgid "CN-Hong Kong" msgstr "中国-香港" @@ -7745,66 +7832,66 @@ msgid "CN East-Shanghai" msgstr "华东-上海" #: xpack/plugins/cloud/providers/baiducloud.py:61 -#: xpack/plugins/cloud/providers/huaweicloud.py:49 +#: xpack/plugins/cloud/providers/huaweicloud.py:51 msgid "AP-Singapore" msgstr "亚太-新加坡" -#: xpack/plugins/cloud/providers/huaweicloud.py:37 -msgid "AF-Johannesburg" -msgstr "非洲-约翰内斯堡" - -#: xpack/plugins/cloud/providers/huaweicloud.py:38 -msgid "CN North-Beijing4" -msgstr "华北-北京4" - #: xpack/plugins/cloud/providers/huaweicloud.py:39 msgid "CN North-Beijing1" msgstr "华北-北京1" #: xpack/plugins/cloud/providers/huaweicloud.py:40 -msgid "CN East-Shanghai2" -msgstr "华东-上海2" +msgid "CN North-Beijing4" +msgstr "华北-北京4" #: xpack/plugins/cloud/providers/huaweicloud.py:41 -msgid "CN East-Shanghai1" -msgstr "华东-上海1" - -#: xpack/plugins/cloud/providers/huaweicloud.py:43 -msgid "LA-Mexico City1" -msgstr "拉美-墨西哥城一" - -#: xpack/plugins/cloud/providers/huaweicloud.py:44 -msgid "LA-Santiago" -msgstr "拉美-圣地亚哥" - -#: xpack/plugins/cloud/providers/huaweicloud.py:45 -msgid "LA-Sao Paulo1" -msgstr "拉美-圣保罗一" - -#: xpack/plugins/cloud/providers/huaweicloud.py:46 -msgid "EU-Paris" -msgstr "欧洲-巴黎" - -#: xpack/plugins/cloud/providers/huaweicloud.py:47 -msgid "CN Southwest-Guiyang1" -msgstr "西南-贵阳1" - -#: xpack/plugins/cloud/providers/huaweicloud.py:48 -msgid "AP-Bangkok" -msgstr "亚太-曼谷" - -#: xpack/plugins/cloud/providers/huaweicloud.py:52 -msgid "CN Northeast-Dalian" -msgstr "华北-大连" - -#: xpack/plugins/cloud/providers/huaweicloud.py:53 msgid "CN North-Ulanqab1" msgstr "华北-乌兰察布一" -#: xpack/plugins/cloud/providers/huaweicloud.py:54 +#: xpack/plugins/cloud/providers/huaweicloud.py:43 +msgid "CN South-Shenzhen" +msgstr "华南-广州" + +#: xpack/plugins/cloud/providers/huaweicloud.py:44 msgid "CN South-Guangzhou-InvitationOnly" msgstr "华南-广州-友好用户环境" +#: xpack/plugins/cloud/providers/huaweicloud.py:45 +msgid "CN East-Shanghai2" +msgstr "华东-上海2" + +#: xpack/plugins/cloud/providers/huaweicloud.py:46 +msgid "CN East-Shanghai1" +msgstr "华东-上海1" + +#: xpack/plugins/cloud/providers/huaweicloud.py:48 +msgid "CN Southwest-Guiyang1" +msgstr "西南-贵阳1" + +#: xpack/plugins/cloud/providers/huaweicloud.py:50 +msgid "AP-Bangkok" +msgstr "亚太-曼谷" + +#: xpack/plugins/cloud/providers/huaweicloud.py:53 +msgid "AF-Johannesburg" +msgstr "非洲-约翰内斯堡" + +#: xpack/plugins/cloud/providers/huaweicloud.py:54 +msgid "LA-Mexico City1" +msgstr "拉美-墨西哥城一" + +#: xpack/plugins/cloud/providers/huaweicloud.py:55 +msgid "LA-Santiago" +msgstr "拉美-圣地亚哥" + +#: xpack/plugins/cloud/providers/huaweicloud.py:56 +msgid "LA-Sao Paulo1" +msgstr "拉美-圣保罗一" + +#: xpack/plugins/cloud/providers/huaweicloud.py:58 +msgid "TR-Istanbul" +msgstr "" + #: xpack/plugins/cloud/providers/jdcloud.py:126 msgid "CN East-Suqian" msgstr "华东-宿迁" @@ -7833,7 +7920,7 @@ msgstr "订阅 ID" #: xpack/plugins/cloud/serializers/account_attrs.py:103 #: xpack/plugins/cloud/serializers/account_attrs.py:119 #: xpack/plugins/cloud/serializers/account_attrs.py:149 -#: xpack/plugins/cloud/serializers/account_attrs.py:202 +#: xpack/plugins/cloud/serializers/account_attrs.py:199 msgid "API Endpoint" msgstr "API 端点" @@ -7898,11 +7985,11 @@ msgstr "测试端口" msgid "Test timeout" msgstr "测试超时时间" -#: xpack/plugins/cloud/serializers/account_attrs.py:212 +#: xpack/plugins/cloud/serializers/account_attrs.py:209 msgid "Project" msgstr "project" -#: xpack/plugins/cloud/serializers/task.py:28 +#: xpack/plugins/cloud/serializers/task.py:139 msgid "" "Only instances matching the IP range will be synced.
If the instance " "contains multiple IP addresses, the first IP address that matches will be " @@ -7914,11 +8001,11 @@ msgstr "" "到的 IP 地址将被用作创建的资产的 IP。
默认值 * 表示同步所有实例和随机匹配 " "IP 地址。
例如: 192.168.1.0/24,10.1.1.1-10.1.1.20。" -#: xpack/plugins/cloud/serializers/task.py:34 +#: xpack/plugins/cloud/serializers/task.py:145 msgid "History count" msgstr "执行次数" -#: xpack/plugins/cloud/serializers/task.py:35 +#: xpack/plugins/cloud/serializers/task.py:146 msgid "Instance count" msgstr "实例个数" @@ -7930,10 +8017,6 @@ msgstr "执行同步实例任务" msgid "Period clean sync instance task execution" msgstr "定期清除同步实例任务执行记录" -#: xpack/plugins/cloud/utils.py:68 -msgid "Account unavailable" -msgstr "账号无效" - #: xpack/plugins/interface/api.py:52 msgid "Restore default successfully." msgstr "恢复默认成功!" @@ -7998,9 +8081,6 @@ msgstr "旗舰版" msgid "Community edition" msgstr "社区版" -#~ msgid "eg: http://dev.jumpserver.org:8080" -#~ msgstr "如: http://dev.jumpserver.org:8080" - #~ msgid "Strategy" #~ msgstr "策略" @@ -8049,11 +8129,8 @@ msgstr "社区版" #~ msgid "Action value" #~ msgstr "动作值" -#~ msgid "Strategy action" -#~ msgstr "策略动作" - -#~ msgid "CN South-Shenzhen" -#~ msgstr "华南-广州" +#~ msgid "CN Northeast-Dalian" +#~ msgstr "华北-大连" #~ msgid "Current only support login from AD/LDAP" #~ msgstr "当前仅支持 AD/LDAP 方式登录的用户" diff --git a/apps/ops/templates/ops/celery_task_log.html b/apps/ops/templates/ops/celery_task_log.html index 3dfc23886..a2a025391 100644 --- a/apps/ops/templates/ops/celery_task_log.html +++ b/apps/ops/templates/ops/celery_task_log.html @@ -135,7 +135,7 @@ method: "GET", flash_message: false, success(data) { - const dateStart = new Date(data.date_start).toLocaleString(); + const dateStart = data.date_start ? new Date(data.date_start).toLocaleString() : ''; $('.task-id').html(data.id); $('.task-type').html(data.task_name); $('.date-start').html(dateStart); diff --git a/apps/perms/api/user_permission/tree/node_with_asset.py b/apps/perms/api/user_permission/tree/node_with_asset.py index 72080247a..d67eda467 100644 --- a/apps/perms/api/user_permission/tree/node_with_asset.py +++ b/apps/perms/api/user_permission/tree/node_with_asset.py @@ -177,8 +177,10 @@ class UserPermedNodeChildrenWithAssetsAsCategoryTreeApi( return [] pid = f'ROOT_{str(assets[0].category).upper()}_{tp}' return self.serialize_assets(assets, pid=pid) + params = self.request.query_params + get_root = not list(filter(lambda x: params.get(x), ('type', 'n'))) resource_platforms = assets.order_by('id').values_list('platform_id', flat=True) - node_all = AllTypes.get_tree_nodes(resource_platforms) + node_all = AllTypes.get_tree_nodes(resource_platforms, get_root=get_root) pattern = re.compile(r'\(0\)?') nodes = [] for node in node_all: diff --git a/apps/rbac/const.py b/apps/rbac/const.py index c484b747f..20f469611 100644 --- a/apps/rbac/const.py +++ b/apps/rbac/const.py @@ -144,7 +144,9 @@ only_system_permissions = ( ('terminal', 'task', '*', '*'), ('terminal', 'endpoint', '*', '*'), ('terminal', 'endpointrule', '*', '*'), - ('authentication', '*', '*', '*'), + ('authentication', 'accesskey', '*', '*'), + ('authentication', 'superconnectiontoken', '*', '*'), + ('authentication', 'temptoken', '*', '*'), ('tickets', '*', '*', '*'), ('orgs', 'organization', 'view', 'rootorg'), ('terminal', 'applet', '*', '*'), diff --git a/apps/rbac/tree.py b/apps/rbac/tree.py index a586208b6..5bbedbbf0 100644 --- a/apps/rbac/tree.py +++ b/apps/rbac/tree.py @@ -70,6 +70,9 @@ special_pid_mapper = { 'xpack.syncinstancedetail': 'cloud_import', 'xpack.syncinstancetask': 'cloud_import', 'xpack.syncinstancetaskexecution': 'cloud_import', + 'xpack.strategy': 'cloud_import', + 'xpack.strategyaction': 'cloud_import', + 'xpack.strategyrule': 'cloud_import', 'terminal.applet': 'remote_application', 'terminal.applethost': 'remote_application', 'accounts.accountbackupautomation': "backup_account_node", diff --git a/poetry.lock b/poetry.lock index 39b36a989..f771d3ca6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2259,44 +2259,24 @@ url = "https://pypi.tuna.tsinghua.edu.cn/simple" reference = "tsinghua" [[package]] -name = "elastic-transport" -version = "8.4.0" -description = "Transport classes and utilities shared among Python Elastic client libraries" +name = "elasticsearch" +version = "7.8.0" +description = "Python client for Elasticsearch" optional = false -python-versions = ">=3.6" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4" files = [ - {file = "elastic-transport-8.4.0.tar.gz", hash = "sha256:b9ad708ceb7fcdbc6b30a96f886609a109f042c0b9d9f2e44403b3133ba7ff10"}, - {file = "elastic_transport-8.4.0-py3-none-any.whl", hash = "sha256:19db271ab79c9f70f8c43f8f5b5111408781a6176b54ab2e54d713b6d9ceb815"}, + {file = "elasticsearch-7.8.0-py2.py3-none-any.whl", hash = "sha256:6fb566dd23b91b5871ce12212888674b4cf33374e92b71b1080916c931e44dcb"}, + {file = "elasticsearch-7.8.0.tar.gz", hash = "sha256:e637d8cf4e27e279b5ff8ca8edc0c086f4b5df4bf2b48e2f950b7833aca3a792"}, ] [package.dependencies] certifi = "*" -urllib3 = ">=1.26.2,<2" +urllib3 = ">=1.21.1" [package.extras] -develop = ["aiohttp", "mock", "pytest", "pytest-asyncio", "pytest-cov", "pytest-httpserver", "pytest-mock", "requests", "trustme"] - -[package.source] -type = "legacy" -url = "https://pypi.tuna.tsinghua.edu.cn/simple" -reference = "tsinghua" - -[[package]] -name = "elasticsearch" -version = "8.8.2" -description = "Python client for Elasticsearch" -optional = false -python-versions = ">=3.6, <4" -files = [ - {file = "elasticsearch-8.8.2-py3-none-any.whl", hash = "sha256:bffd6ce4faaacf90e6f617241773b3da8fb94e2e83554f5508e2fab92ca79643"}, - {file = "elasticsearch-8.8.2.tar.gz", hash = "sha256:bed8cf8fcc6c3be7c254b579de4c29afab021f373c832246f912d37aef3c6bd5"}, -] - -[package.dependencies] -elastic-transport = ">=8,<9" - -[package.extras] -async = ["aiohttp (>=3,<4)"] +async = ["aiohttp (>=3,<4)", "yarl"] +develop = ["black", "coverage", "jinja2", "mock", "pytest", "pytest-cov", "pyyaml", "requests (>=2.0.0,<3.0.0)", "sphinx (<1.7)", "sphinx-rtd-theme"] +docs = ["sphinx (<1.7)", "sphinx-rtd-theme"] requests = ["requests (>=2.4.0,<3.0.0)"] [package.source] @@ -3378,12 +3358,12 @@ reference = "tsinghua" [[package]] name = "jms-storage" -version = "0.0.50" +version = "0.0.51" description = "Jumpserver storage python sdk tools" optional = false python-versions = "*" files = [ - {file = "jms-storage-0.0.50.tar.gz", hash = "sha256:f757180e145a9eb3390b8b32663a5feebcb1e720a6f2c36cc16f726ac047f28b"}, + {file = "jms-storage-0.0.51.tar.gz", hash = "sha256:47a50ac4d952a21693b0e2f926f42fa0d02bc1fa8e507a8284059743b2b81911"}, ] [package.dependencies] @@ -3395,7 +3375,7 @@ certifi = "2023.7.22" chardet = "5.1.0" crcmod = "1.7" docutils = "0.20.1" -elasticsearch = "8.8.2" +elasticsearch = "7.8.0" esdk-obs-python = "3.21.4" idna = "3.4" oss2 = "2.18.1" @@ -7244,4 +7224,4 @@ reference = "tsinghua" [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "acdb324e0081968235e843be40803734f3ab814de44c90c4367fa0ef0801759d" +content-hash = "9bb582f0c306346ea364334a31c1b10b21e6beb5e3448b85cc397c744db6d2a9" diff --git a/pyproject.toml b/pyproject.toml index 069fd91a4..06d981f79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ pynacl = "1.5.0" python-dateutil = "2.8.2" pyyaml = "6.0.1" requests = "2.31.0" -jms-storage = "0.0.50" +jms-storage = "0.0.51" simplejson = "3.19.1" six = "1.16.0" sshtunnel = "0.4.0"