mirror of https://github.com/jumpserver/jumpserver
parent
266e7e0dd7
commit
b41880d4f2
|
@ -1,14 +1,14 @@
|
|||
from django.utils.translation import ugettext as _
|
||||
from rest_framework import serializers
|
||||
|
||||
from ops.mixin import PeriodTaskSerializerMixin
|
||||
from accounts.models import AutomationExecution
|
||||
from assets.const import AutomationTypes
|
||||
from assets.models import Asset, Node, BaseAutomation
|
||||
from accounts.models import AutomationExecution
|
||||
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
||||
from common.utils import get_logger
|
||||
from common.const.choices import Trigger
|
||||
from common.serializers.fields import ObjectRelatedField, LabeledChoiceField
|
||||
from common.utils import get_logger
|
||||
from ops.mixin import PeriodTaskSerializerMixin
|
||||
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
||||
|
||||
logger = get_logger(__file__)
|
||||
|
||||
|
@ -37,6 +37,15 @@ class BaseAutomationSerializer(PeriodTaskSerializerMixin, BulkOrgResourceModelSe
|
|||
'executed_amount': {'label': _('Executed amount')},
|
||||
}
|
||||
|
||||
def validate_name(self, name):
|
||||
if BaseAutomation.objects.filter(name=name, type=self.model_type).exists():
|
||||
raise serializers.ValidationError(_('Name already exists'))
|
||||
return name
|
||||
|
||||
@property
|
||||
def model_type(self):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class AutomationExecutionSerializer(serializers.ModelSerializer):
|
||||
snapshot = serializers.SerializerMethodField(label=_('Automation snapshot'))
|
||||
|
|
|
@ -4,13 +4,13 @@ from django.utils.translation import ugettext as _
|
|||
from rest_framework import serializers
|
||||
|
||||
from accounts.const import (
|
||||
DEFAULT_PASSWORD_RULES, SecretType, SecretStrategy, SSHKeyStrategy
|
||||
AutomationTypes, DEFAULT_PASSWORD_RULES,
|
||||
SecretType, SecretStrategy, SSHKeyStrategy
|
||||
)
|
||||
from accounts.models import (
|
||||
Account, ChangeSecretAutomation,
|
||||
ChangeSecretRecord
|
||||
ChangeSecretRecord, AutomationExecution
|
||||
)
|
||||
from accounts.models import AutomationExecution
|
||||
from accounts.serializers import AuthValidateMixin
|
||||
from assets.models import Asset
|
||||
from common.serializers.fields import LabeledChoiceField, ObjectRelatedField
|
||||
|
@ -58,6 +58,9 @@ class ChangeSecretAutomationSerializer(AuthValidateMixin, BaseAutomationSerializ
|
|||
"Currently only mail sending is supported"
|
||||
)},
|
||||
}}
|
||||
@property
|
||||
def model_type(self):
|
||||
return AutomationTypes.change_secret
|
||||
|
||||
def validate_password_rules(self, password_rules):
|
||||
secret_type = self.initial_data['secret_type']
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from accounts.const import AutomationTypes
|
||||
from accounts.models import GatherAccountsAutomation
|
||||
from common.utils import get_logger
|
||||
|
||||
|
@ -20,3 +20,7 @@ class GatherAccountAutomationSerializer(BaseAutomationSerializer):
|
|||
fields = BaseAutomationSerializer.Meta.fields + read_only_fields
|
||||
|
||||
extra_kwargs = BaseAutomationSerializer.Meta.extra_kwargs
|
||||
|
||||
@property
|
||||
def model_type(self):
|
||||
return AutomationTypes.gather_accounts
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import copy
|
||||
from accounts.const import AutomationTypes
|
||||
from accounts.models import PushAccountAutomation
|
||||
from .change_secret import (
|
||||
ChangeSecretAutomationSerializer, ChangeSecretUpdateAssetSerializer,
|
||||
|
@ -14,6 +14,10 @@ class PushAccountAutomationSerializer(ChangeSecretAutomationSerializer):
|
|||
if n not in ['recipients']
|
||||
]
|
||||
|
||||
@property
|
||||
def model_type(self):
|
||||
return AutomationTypes.push_account
|
||||
|
||||
|
||||
class PushAccountUpdateAssetSerializer(ChangeSecretUpdateAssetSerializer):
|
||||
class Meta:
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:014483808a830a01f5432fdc44bc34f7f392e53a160ffa97eb377dbb49e0ec9a
|
||||
size 135547
|
||||
oid sha256:331188bb5169bb463da018a635589e12a2136d476db264ac7e5d6e5d63ca474a
|
||||
size 135916
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-02-21 13:46+0800\n"
|
||||
"POT-Creation-Date: 2023-02-21 18:29+0800\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -162,8 +162,8 @@ msgstr "作成のみ"
|
|||
#: accounts/models/automations/gather_account.py:16
|
||||
#: accounts/serializers/account/account.py:95
|
||||
#: accounts/serializers/account/gathered_account.py:10
|
||||
#: accounts/serializers/automations/change_secret.py:107
|
||||
#: accounts/serializers/automations/change_secret.py:127
|
||||
#: accounts/serializers/automations/change_secret.py:111
|
||||
#: accounts/serializers/automations/change_secret.py:131
|
||||
#: acls/models/base.py:100 acls/serializers/base.py:56
|
||||
#: assets/models/asset/common.py:92 assets/models/asset/common.py:279
|
||||
#: assets/models/cmd_filter.py:36 assets/serializers/domain.py:19
|
||||
|
@ -192,8 +192,8 @@ msgid "Source"
|
|||
msgstr "ソース"
|
||||
|
||||
#: accounts/models/account.py:58
|
||||
#: accounts/serializers/automations/change_secret.py:108
|
||||
#: accounts/serializers/automations/change_secret.py:128
|
||||
#: accounts/serializers/automations/change_secret.py:112
|
||||
#: accounts/serializers/automations/change_secret.py:132
|
||||
#: acls/models/base.py:102 acls/serializers/base.py:57
|
||||
#: assets/serializers/asset/common.py:125 assets/serializers/gateway.py:28
|
||||
#: audits/models.py:49 ops/models/base.py:18
|
||||
|
@ -238,7 +238,7 @@ msgstr "アセット アカウント テンプレートのパスワードを変
|
|||
#: accounts/models/automations/backup_account.py:27
|
||||
#: accounts/models/automations/change_secret.py:47
|
||||
#: accounts/serializers/account/backup.py:34
|
||||
#: accounts/serializers/automations/change_secret.py:56
|
||||
#: accounts/serializers/automations/change_secret.py:57
|
||||
msgid "Recipient"
|
||||
msgstr "受信者"
|
||||
|
||||
|
@ -269,7 +269,7 @@ msgstr "アカウントのバックアップスナップショット"
|
|||
|
||||
#: accounts/models/automations/backup_account.py:94
|
||||
#: accounts/serializers/account/backup.py:42
|
||||
#: accounts/serializers/automations/base.py:44
|
||||
#: accounts/serializers/automations/base.py:53
|
||||
#: assets/models/automations/base.py:121
|
||||
#: assets/serializers/automations/base.py:40
|
||||
msgid "Trigger mode"
|
||||
|
@ -281,8 +281,8 @@ msgid "Reason"
|
|||
msgstr "理由"
|
||||
|
||||
#: accounts/models/automations/backup_account.py:99
|
||||
#: accounts/serializers/automations/change_secret.py:106
|
||||
#: accounts/serializers/automations/change_secret.py:129
|
||||
#: accounts/serializers/automations/change_secret.py:110
|
||||
#: accounts/serializers/automations/change_secret.py:133
|
||||
#: ops/serializers/job.py:64 terminal/serializers/session.py:45
|
||||
msgid "Is success"
|
||||
msgstr "成功は"
|
||||
|
@ -540,7 +540,7 @@ msgid "Category"
|
|||
msgstr "カテゴリ"
|
||||
|
||||
#: accounts/serializers/account/account.py:76
|
||||
#: accounts/serializers/automations/base.py:43 acls/models/command_acl.py:24
|
||||
#: accounts/serializers/automations/base.py:52 acls/models/command_acl.py:24
|
||||
#: acls/serializers/command_acl.py:18 applications/models.py:14
|
||||
#: assets/models/_user.py:50 assets/models/automations/base.py:20
|
||||
#: assets/models/cmd_filter.py:74 assets/models/platform.py:78
|
||||
|
@ -575,7 +575,7 @@ msgid "Executed amount"
|
|||
msgstr "実行回数"
|
||||
|
||||
#: accounts/serializers/account/backup.py:35
|
||||
#: accounts/serializers/automations/change_secret.py:57
|
||||
#: accounts/serializers/automations/change_secret.py:58
|
||||
msgid "Currently only mail sending is supported"
|
||||
msgstr "現在、メール送信のみがサポートされています"
|
||||
|
||||
|
@ -612,6 +612,10 @@ msgid "Nodes"
|
|||
msgstr "ノード"
|
||||
|
||||
#: accounts/serializers/automations/base.py:42
|
||||
msgid "Name already exists"
|
||||
msgstr "名前は既に存在します。"
|
||||
|
||||
#: accounts/serializers/automations/base.py:51
|
||||
#: assets/models/automations/base.py:117
|
||||
#: assets/serializers/automations/base.py:39
|
||||
msgid "Automation snapshot"
|
||||
|
@ -621,20 +625,20 @@ msgstr "自動スナップショット"
|
|||
msgid "SSH Key strategy"
|
||||
msgstr "SSHキー戦略"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:76
|
||||
#: accounts/serializers/automations/change_secret.py:80
|
||||
msgid "* Please enter the correct password length"
|
||||
msgstr "* 正しいパスワードの長さを入力してください"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:80
|
||||
#: accounts/serializers/automations/change_secret.py:84
|
||||
msgid "* Password length range 6-30 bits"
|
||||
msgstr "* パスワードの長さの範囲6-30ビット"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:110
|
||||
#: accounts/serializers/automations/change_secret.py:114
|
||||
#: assets/models/automations/base.py:126
|
||||
msgid "Automation task execution"
|
||||
msgstr "自動タスク実行履歴"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:150 audits/const.py:52
|
||||
#: accounts/serializers/automations/change_secret.py:154 audits/const.py:52
|
||||
#: audits/models.py:54 audits/signal_handlers/activity_log.py:33
|
||||
#: common/const/choices.py:18 ops/const.py:56 ops/serializers/celery.py:39
|
||||
#: terminal/const.py:59 terminal/models/session/sharing.py:103
|
||||
|
@ -642,7 +646,7 @@ msgstr "自動タスク実行履歴"
|
|||
msgid "Success"
|
||||
msgstr "成功"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:151 audits/const.py:53
|
||||
#: accounts/serializers/automations/change_secret.py:155 audits/const.py:53
|
||||
#: audits/signal_handlers/activity_log.py:33 common/const/choices.py:19
|
||||
#: ops/const.py:58 terminal/const.py:60 xpack/plugins/cloud/const.py:41
|
||||
msgid "Failed"
|
||||
|
@ -7286,6 +7290,14 @@ msgstr "実行回数"
|
|||
msgid "Instance count"
|
||||
msgstr "インスタンス数"
|
||||
|
||||
#: xpack/plugins/cloud/tasks.py:27
|
||||
msgid "Run sync instance task"
|
||||
msgstr "同期インスタンス タスクを実行する"
|
||||
|
||||
#: xpack/plugins/cloud/tasks.py:41
|
||||
msgid "Period clean sync instance task execution"
|
||||
msgstr "同期インスタンス タスクの実行記録を定期的にクリアする"
|
||||
|
||||
#: xpack/plugins/cloud/utils.py:69
|
||||
msgid "Account unavailable"
|
||||
msgstr "利用できないアカウント"
|
||||
|
@ -7365,9 +7377,3 @@ msgstr "コミュニティ版"
|
|||
|
||||
#~ msgid "Remove asset from node"
|
||||
#~ msgstr "ノードからアセットを削除"
|
||||
|
||||
#~ msgid "Run sync instance task"
|
||||
#~ msgstr "同期インスタンス タスクを実行する"
|
||||
|
||||
#~ msgid "Period clean sync instance task execution"
|
||||
#~ msgstr "同期インスタンス タスクの実行記録を定期的にクリアする"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1c1524b6173a2613845d9450d84ef8ca9cf1be6d0f7cdae2a89f6131d6abc1f1
|
||||
size 111449
|
||||
oid sha256:2cdc2b875c98f41bd698833a989195d8cc4245f39f52b7eab41ad4d95075cb17
|
||||
size 111666
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: JumpServer 0.3.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-02-21 13:46+0800\n"
|
||||
"POT-Creation-Date: 2023-02-21 18:29+0800\n"
|
||||
"PO-Revision-Date: 2021-05-20 10:54+0800\n"
|
||||
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
||||
"Language-Team: JumpServer team<ibuler@qq.com>\n"
|
||||
|
@ -161,8 +161,8 @@ msgstr "仅创建"
|
|||
#: accounts/models/automations/gather_account.py:16
|
||||
#: accounts/serializers/account/account.py:95
|
||||
#: accounts/serializers/account/gathered_account.py:10
|
||||
#: accounts/serializers/automations/change_secret.py:107
|
||||
#: accounts/serializers/automations/change_secret.py:127
|
||||
#: accounts/serializers/automations/change_secret.py:111
|
||||
#: accounts/serializers/automations/change_secret.py:131
|
||||
#: acls/models/base.py:100 acls/serializers/base.py:56
|
||||
#: assets/models/asset/common.py:92 assets/models/asset/common.py:279
|
||||
#: assets/models/cmd_filter.py:36 assets/serializers/domain.py:19
|
||||
|
@ -191,8 +191,8 @@ msgid "Source"
|
|||
msgstr "来源"
|
||||
|
||||
#: accounts/models/account.py:58
|
||||
#: accounts/serializers/automations/change_secret.py:108
|
||||
#: accounts/serializers/automations/change_secret.py:128
|
||||
#: accounts/serializers/automations/change_secret.py:112
|
||||
#: accounts/serializers/automations/change_secret.py:132
|
||||
#: acls/models/base.py:102 acls/serializers/base.py:57
|
||||
#: assets/serializers/asset/common.py:125 assets/serializers/gateway.py:28
|
||||
#: audits/models.py:49 ops/models/base.py:18
|
||||
|
@ -237,7 +237,7 @@ msgstr "可以更改资产账号模版密码"
|
|||
#: accounts/models/automations/backup_account.py:27
|
||||
#: accounts/models/automations/change_secret.py:47
|
||||
#: accounts/serializers/account/backup.py:34
|
||||
#: accounts/serializers/automations/change_secret.py:56
|
||||
#: accounts/serializers/automations/change_secret.py:57
|
||||
msgid "Recipient"
|
||||
msgstr "收件人"
|
||||
|
||||
|
@ -268,7 +268,7 @@ msgstr "账号备份快照"
|
|||
|
||||
#: accounts/models/automations/backup_account.py:94
|
||||
#: accounts/serializers/account/backup.py:42
|
||||
#: accounts/serializers/automations/base.py:44
|
||||
#: accounts/serializers/automations/base.py:53
|
||||
#: assets/models/automations/base.py:121
|
||||
#: assets/serializers/automations/base.py:40
|
||||
msgid "Trigger mode"
|
||||
|
@ -280,8 +280,8 @@ msgid "Reason"
|
|||
msgstr "原因"
|
||||
|
||||
#: accounts/models/automations/backup_account.py:99
|
||||
#: accounts/serializers/automations/change_secret.py:106
|
||||
#: accounts/serializers/automations/change_secret.py:129
|
||||
#: accounts/serializers/automations/change_secret.py:110
|
||||
#: accounts/serializers/automations/change_secret.py:133
|
||||
#: ops/serializers/job.py:64 terminal/serializers/session.py:45
|
||||
msgid "Is success"
|
||||
msgstr "是否成功"
|
||||
|
@ -536,7 +536,7 @@ msgid "Category"
|
|||
msgstr "类别"
|
||||
|
||||
#: accounts/serializers/account/account.py:76
|
||||
#: accounts/serializers/automations/base.py:43 acls/models/command_acl.py:24
|
||||
#: accounts/serializers/automations/base.py:52 acls/models/command_acl.py:24
|
||||
#: acls/serializers/command_acl.py:18 applications/models.py:14
|
||||
#: assets/models/_user.py:50 assets/models/automations/base.py:20
|
||||
#: assets/models/cmd_filter.py:74 assets/models/platform.py:78
|
||||
|
@ -571,7 +571,7 @@ msgid "Executed amount"
|
|||
msgstr "执行次数"
|
||||
|
||||
#: accounts/serializers/account/backup.py:35
|
||||
#: accounts/serializers/automations/change_secret.py:57
|
||||
#: accounts/serializers/automations/change_secret.py:58
|
||||
msgid "Currently only mail sending is supported"
|
||||
msgstr "当前只支持邮件发送"
|
||||
|
||||
|
@ -608,6 +608,10 @@ msgid "Nodes"
|
|||
msgstr "节点"
|
||||
|
||||
#: accounts/serializers/automations/base.py:42
|
||||
msgid "Name already exists"
|
||||
msgstr "名称已存在"
|
||||
|
||||
#: accounts/serializers/automations/base.py:51
|
||||
#: assets/models/automations/base.py:117
|
||||
#: assets/serializers/automations/base.py:39
|
||||
msgid "Automation snapshot"
|
||||
|
@ -617,20 +621,20 @@ msgstr "自动化快照"
|
|||
msgid "SSH Key strategy"
|
||||
msgstr "SSH 密钥更改方式"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:76
|
||||
#: accounts/serializers/automations/change_secret.py:80
|
||||
msgid "* Please enter the correct password length"
|
||||
msgstr "* 请输入正确的密码长度"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:80
|
||||
#: accounts/serializers/automations/change_secret.py:84
|
||||
msgid "* Password length range 6-30 bits"
|
||||
msgstr "* 密码长度范围 6-30 位"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:110
|
||||
#: accounts/serializers/automations/change_secret.py:114
|
||||
#: assets/models/automations/base.py:126
|
||||
msgid "Automation task execution"
|
||||
msgstr "自动化任务执行历史"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:150 audits/const.py:52
|
||||
#: accounts/serializers/automations/change_secret.py:154 audits/const.py:52
|
||||
#: audits/models.py:54 audits/signal_handlers/activity_log.py:33
|
||||
#: common/const/choices.py:18 ops/const.py:56 ops/serializers/celery.py:39
|
||||
#: terminal/const.py:59 terminal/models/session/sharing.py:103
|
||||
|
@ -638,7 +642,7 @@ msgstr "自动化任务执行历史"
|
|||
msgid "Success"
|
||||
msgstr "成功"
|
||||
|
||||
#: accounts/serializers/automations/change_secret.py:151 audits/const.py:53
|
||||
#: accounts/serializers/automations/change_secret.py:155 audits/const.py:53
|
||||
#: audits/signal_handlers/activity_log.py:33 common/const/choices.py:19
|
||||
#: ops/const.py:58 terminal/const.py:60 xpack/plugins/cloud/const.py:41
|
||||
msgid "Failed"
|
||||
|
@ -7191,6 +7195,14 @@ msgstr "执行次数"
|
|||
msgid "Instance count"
|
||||
msgstr "实例个数"
|
||||
|
||||
#: xpack/plugins/cloud/tasks.py:27
|
||||
msgid "Run sync instance task"
|
||||
msgstr "执行同步实例任务"
|
||||
|
||||
#: xpack/plugins/cloud/tasks.py:41
|
||||
msgid "Period clean sync instance task execution"
|
||||
msgstr "定期清除同步实例任务执行记录"
|
||||
|
||||
#: xpack/plugins/cloud/utils.py:69
|
||||
msgid "Account unavailable"
|
||||
msgstr "账号无效"
|
||||
|
@ -7271,12 +7283,6 @@ msgstr "社区版"
|
|||
#~ msgid "Remove asset from node"
|
||||
#~ msgstr "从节点移除资产"
|
||||
|
||||
#~ msgid "Run sync instance task"
|
||||
#~ msgstr "执行同步实例任务"
|
||||
|
||||
#~ msgid "Period clean sync instance task execution"
|
||||
#~ msgstr "定期清除同步实例任务执行记录"
|
||||
|
||||
#~ msgid "Clean audits log"
|
||||
#~ msgstr "清理审计日志"
|
||||
|
||||
|
|
Loading…
Reference in New Issue