From c341d01e5a96191da7abef6b76706fbd4f6d6982 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 21 Oct 2021 20:03:05 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/locale/zh/LC_MESSAGES/django.mo | 4 +- apps/locale/zh/LC_MESSAGES/django.po | 394 +++++++++--------- apps/perms/notifications.py | 14 +- apps/tickets/handler/apply_application.py | 10 +- apps/tickets/handler/apply_asset.py | 8 +- apps/tickets/handler/base.py | 15 +- apps/tickets/handler/command_confirm.py | 13 +- apps/tickets/handler/login_asset_confirm.py | 5 +- apps/tickets/handler/login_confirm.py | 5 +- apps/tickets/notifications.py | 32 +- .../templates/tickets/_base_ticket_body.html | 20 + .../templates/tickets/_msg_ticket.html | 1 + 12 files changed, 279 insertions(+), 242 deletions(-) create mode 100644 apps/tickets/templates/tickets/_base_ticket_body.html diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index c16f2930a..4944330cb 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:39e9d8c61c6986a067d9c0c82d2a459e07bcc78d07d9bdd1c5934154ea3a198d -size 91321 +oid sha256:b5a90a96a51ef2f38d4530f3e5b79cd59b07dbca39f60bc35cde5ee0e364b210 +size 91089 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 2987511f3..ae72cdc87 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: 2021-10-20 18:58+0800\n" +"POT-Creation-Date: 2021-10-21 18:50+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -25,7 +25,7 @@ msgstr "" #: orgs/models.py:24 perms/models/base.py:44 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:604 +#: users/forms/profile.py:32 users/models/group.py:15 users/models/user.py:597 #: users/templates/users/_select_user_modal.html:13 #: users/templates/users/user_asset_permission.html:37 #: users/templates/users/user_asset_permission.html:154 @@ -44,7 +44,7 @@ msgstr "优先级" msgid "1-100, the lower the value will be match first" msgstr "优先级可选范围为 1-100 (数值越小越优先)" -#: acls/models/base.py:31 authentication/models.py:20 +#: acls/models/base.py:31 authentication/models.py:17 #: authentication/templates/authentication/_access_key_modal.html:32 #: perms/models/base.py:48 terminal/models/sharing.py:24 #: users/templates/users/_select_user_modal.html:18 @@ -60,47 +60,35 @@ msgstr "激活中" #: orgs/models.py:27 perms/models/base.py:53 settings/models.py:34 #: terminal/models/storage.py:26 terminal/models/terminal.py:114 #: tickets/models/ticket.py:71 users/models/group.py:16 -#: users/models/user.py:637 xpack/plugins/change_auth_plan/models/base.py:41 +#: users/models/user.py:630 xpack/plugins/change_auth_plan/models/base.py:41 #: xpack/plugins/cloud/models.py:35 xpack/plugins/cloud/models.py:113 #: xpack/plugins/gathered_user/models.py:26 msgid "Comment" msgstr "备注" -#: acls/models/login_acl.py:16 tickets/const.py:38 +#: acls/models/login_acl.py:19 tickets/const.py:38 msgid "Reject" msgstr "拒绝" -#: acls/models/login_acl.py:17 assets/models/cmd_filter.py:48 +#: acls/models/login_acl.py:20 assets/models/cmd_filter.py:48 msgid "Allow" msgstr "允许" -#: acls/models/login_acl.py:20 -msgid "Login IP" -msgstr "登录IP" - -#: acls/models/login_acl.py:24 acls/models/login_asset_acl.py:26 -#: acls/serializers/login_acl.py:34 acls/serializers/login_asset_acl.py:75 -#: assets/models/cmd_filter.py:57 audits/models.py:57 -#: authentication/templates/authentication/_access_key_modal.html:34 -#: users/templates/users/_granted_assets.html:29 -#: users/templates/users/user_asset_permission.html:44 -#: users/templates/users/user_asset_permission.html:79 -#: users/templates/users/user_database_app_permission.html:42 -msgid "Action" -msgstr "动作" +#: acls/models/login_acl.py:21 acls/models/login_acl.py:113 +#: acls/models/login_asset_acl.py:17 tickets/const.py:9 +msgid "Login confirm" +msgstr "登录复核" -#: acls/models/login_acl.py:28 acls/models/login_asset_acl.py:20 -#: acls/serializers/login_acl.py:33 assets/models/label.py:15 -#: audits/models.py:36 audits/models.py:56 audits/models.py:74 -#: audits/serializers.py:93 authentication/models.py:44 -#: authentication/models.py:100 orgs/models.py:19 orgs/models.py:433 -#: perms/models/base.py:45 templates/index.html:78 -#: terminal/backends/command/models.py:18 +#: acls/models/login_acl.py:25 acls/models/login_asset_acl.py:20 +#: assets/models/label.py:15 audits/models.py:36 audits/models.py:56 +#: audits/models.py:74 audits/serializers.py:94 authentication/models.py:47 +#: orgs/models.py:19 orgs/models.py:433 perms/models/base.py:45 +#: templates/index.html:78 terminal/backends/command/models.py:18 #: terminal/backends/command/serializers.py:12 terminal/models/session.py:38 #: terminal/templates/terminal/_msg_command_alert.html:10 -#: terminal/templates/terminal/_msg_command_execue_alert.html:4 -#: tickets/models/comment.py:17 users/const.py:14 users/models/user.py:180 -#: users/models/user.py:813 users/models/user.py:839 +#: terminal/templates/terminal/_msg_command_execute_alert.html:4 +#: tickets/models/comment.py:17 users/const.py:14 users/models/user.py:173 +#: users/models/user.py:801 users/models/user.py:827 #: users/serializers/group.py:19 #: users/templates/users/user_asset_permission.html:38 #: users/templates/users/user_asset_permission.html:64 @@ -109,10 +97,25 @@ msgstr "动作" msgid "User" msgstr "用户" -#: acls/models/login_asset_acl.py:17 authentication/models.py:75 -#: tickets/const.py:9 -msgid "Login confirm" -msgstr "登录复核" +#: acls/models/login_acl.py:29 +msgid "Rule" +msgstr "" + +#: acls/models/login_acl.py:32 acls/models/login_asset_acl.py:26 +#: acls/serializers/login_acl.py:16 acls/serializers/login_asset_acl.py:75 +#: assets/models/cmd_filter.py:57 audits/models.py:57 +#: authentication/templates/authentication/_access_key_modal.html:34 +#: users/templates/users/_granted_assets.html:29 +#: users/templates/users/user_asset_permission.html:44 +#: users/templates/users/user_asset_permission.html:79 +#: users/templates/users/user_database_app_permission.html:42 +msgid "Action" +msgstr "动作" + +#: acls/models/login_acl.py:36 acls/models/login_asset_acl.py:32 +#: acls/serializers/login_acl.py:15 assets/models/cmd_filter.py:62 +msgid "Reviewers" +msgstr "审批人" #: acls/models/login_asset_acl.py:21 msgid "System User" @@ -133,48 +136,15 @@ msgstr "系统用户" msgid "Asset" msgstr "资产" -#: acls/models/login_asset_acl.py:32 assets/models/cmd_filter.py:62 -#: authentication/models.py:45 -msgid "Reviewers" -msgstr "审批人" - #: acls/models/login_asset_acl.py:89 tickets/const.py:12 msgid "Login asset confirm" msgstr "登录资产复核" -#: acls/serializers/login_acl.py:18 xpack/plugins/cloud/serializers/task.py:23 -msgid "IP address invalid: `{}`" -msgstr "IP 地址无效: `{}`" - -#: acls/serializers/login_acl.py:24 -msgid "" -"Format for comma-delimited string, with * indicating a match all. Such as: " -"192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:" -"db8:1a:1110::/64 " -msgstr "" -"格式为逗号分隔的字符串, * 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, " -"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64" - -#: acls/serializers/login_acl.py:30 acls/serializers/login_asset_acl.py:31 -#: applications/serializers/attrs/application_type/mysql_workbench.py:18 -#: assets/models/asset.py:180 assets/models/domain.py:61 -#: assets/serializers/account.py:12 -#: authentication/templates/authentication/_msg_rest_password_success.html:9 -#: settings/serializers/terminal.py:8 -#: users/templates/users/_granted_assets.html:26 -#: users/templates/users/user_asset_permission.html:156 -msgid "IP" -msgstr "IP" - -#: acls/serializers/login_acl.py:55 -msgid "The user `{}` is not in the current organization: `{}`" -msgstr "用户 `{}` 不在当前组织: `{}`" - -#: acls/serializers/login_asset_acl.py:12 +#: acls/serializers/login_acl.py:10 acls/serializers/login_asset_acl.py:12 msgid "Format for comma-delimited string, with * indicating a match all. " msgstr "格式为逗号分隔的字符串, * 表示匹配所有. " -#: acls/serializers/login_asset_acl.py:17 +#: acls/serializers/login_acl.py:14 acls/serializers/login_asset_acl.py:17 #: acls/serializers/login_asset_acl.py:51 #: applications/serializers/attrs/application_type/chrome.py:20 #: applications/serializers/attrs/application_type/custom.py:21 @@ -183,7 +153,7 @@ msgstr "格式为逗号分隔的字符串, * 表示匹配所有. " #: assets/models/base.py:176 assets/models/gathered_user.py:15 #: audits/models.py:105 authentication/forms.py:15 authentication/forms.py:17 #: authentication/templates/authentication/_msg_different_city.html:9 -#: ops/models/adhoc.py:148 users/forms/profile.py:31 users/models/user.py:602 +#: ops/models/adhoc.py:148 users/forms/profile.py:31 users/models/user.py:595 #: users/templates/users/_select_user_modal.html:14 #: xpack/plugins/change_auth_plan/models/asset.py:35 #: xpack/plugins/change_auth_plan/models/asset.py:191 @@ -200,6 +170,17 @@ msgstr "" "格式为逗号分隔的字符串, * 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, " "10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64 (支持网域)" +#: acls/serializers/login_asset_acl.py:31 acls/serializers/rules/rules.py:32 +#: applications/serializers/attrs/application_type/mysql_workbench.py:18 +#: assets/models/asset.py:180 assets/models/domain.py:61 +#: assets/serializers/account.py:12 +#: authentication/templates/authentication/_msg_rest_password_success.html:9 +#: settings/serializers/terminal.py:8 +#: users/templates/users/_granted_assets.html:26 +#: users/templates/users/user_asset_permission.html:156 +msgid "IP" +msgstr "IP" + #: acls/serializers/login_asset_acl.py:35 assets/models/asset.py:181 #: assets/serializers/account.py:13 assets/serializers/gathered_user.py:23 #: settings/serializers/terminal.py:7 @@ -233,6 +214,24 @@ msgstr "组织 `{}` 不存在" msgid "None of the reviewers belong to Organization `{}`" msgstr "所有复核人都不属于组织 `{}`" +#: acls/serializers/rules/rules.py:20 +#: xpack/plugins/cloud/serializers/task.py:23 +msgid "IP address invalid: `{}`" +msgstr "IP 地址无效: `{}`" + +#: acls/serializers/rules/rules.py:26 +msgid "" +"Format for comma-delimited string, with * indicating a match all. Such as: " +"192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:" +"db8:1a:1110::/64 " +msgstr "" +"格式为逗号分隔的字符串, * 表示匹配所有。例如: 192.168.10.1, 192.168.1.0/24, " +"10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64" + +#: acls/serializers/rules/rules.py:34 +msgid "Time Period" +msgstr "" + #: applications/api/mixin.py:20 templates/_nav_user.html:10 msgid "My applications" msgstr "我的应用" @@ -456,7 +455,6 @@ msgstr "节点" #: assets/models/asset.py:190 assets/models/cmd_filter.py:22 #: assets/models/domain.py:66 assets/models/label.py:22 -#: authentication/models.py:46 msgid "Is active" msgstr "激活" @@ -537,7 +535,7 @@ msgstr "标签管理" #: assets/models/cluster.py:28 assets/models/cmd_filter.py:26 #: assets/models/cmd_filter.py:67 assets/models/group.py:21 #: common/db/models.py:70 common/mixins/models.py:49 orgs/models.py:25 -#: orgs/models.py:437 perms/models/base.py:51 users/models/user.py:645 +#: orgs/models.py:437 perms/models/base.py:51 users/models/user.py:638 #: users/serializers/group.py:33 #: xpack/plugins/change_auth_plan/models/base.py:45 #: xpack/plugins/cloud/models.py:119 xpack/plugins/gathered_user/models.py:30 @@ -550,7 +548,7 @@ msgstr "创建者" #: assets/models/label.py:25 common/db/models.py:72 common/mixins/models.py:50 #: ops/models/adhoc.py:38 ops/models/command.py:29 orgs/models.py:26 #: orgs/models.py:435 perms/models/base.py:52 users/models/group.py:18 -#: users/models/user.py:840 xpack/plugins/cloud/models.py:122 +#: users/models/user.py:828 xpack/plugins/cloud/models.py:122 msgid "Date created" msgstr "创建日期" @@ -605,7 +603,7 @@ msgstr "带宽" msgid "Contact" msgstr "联系人" -#: assets/models/cluster.py:22 users/models/user.py:623 +#: assets/models/cluster.py:22 users/models/user.py:616 msgid "Phone" msgstr "手机" @@ -631,7 +629,7 @@ msgid "Default" msgstr "默认" #: assets/models/cluster.py:36 assets/models/label.py:14 -#: users/models/user.py:825 +#: users/models/user.py:813 msgid "System" msgstr "系统" @@ -650,7 +648,7 @@ msgstr "正则表达式" #: assets/models/cmd_filter.py:41 ops/models/command.py:25 #: terminal/backends/command/serializers.py:15 terminal/models/session.py:49 #: terminal/templates/terminal/_msg_command_alert.html:4 -#: terminal/templates/terminal/_msg_command_execue_alert.html:15 +#: terminal/templates/terminal/_msg_command_execute_alert.html:10 msgid "Command" msgstr "命令" @@ -774,7 +772,7 @@ msgstr "用户名与用户相同" #: assets/models/user.py:200 assets/serializers/domain.py:29 #: templates/_nav.html:39 -#: terminal/templates/terminal/_msg_command_execue_alert.html:10 +#: terminal/templates/terminal/_msg_command_execute_alert.html:16 #: xpack/plugins/change_auth_plan/models/asset.py:40 msgid "Assets" msgstr "资产" @@ -808,7 +806,7 @@ msgstr "认证方式" msgid "SFTP Root" msgstr "SFTP根路径" -#: assets/models/user.py:215 authentication/models.py:98 +#: assets/models/user.py:215 authentication/models.py:45 msgid "Token" msgstr "" @@ -1176,12 +1174,12 @@ msgstr "用户代理" #: audits/models.py:110 #: authentication/templates/authentication/_mfa_confirm_modal.html:14 #: authentication/templates/authentication/login_otp.html:6 -#: users/forms/profile.py:64 users/models/user.py:626 +#: users/forms/profile.py:64 users/models/user.py:619 #: users/serializers/profile.py:102 msgid "MFA" msgstr "多因子认证" -#: audits/models.py:111 terminal/models/sharing.py:88 +#: audits/models.py:111 audits/serializers.py:45 terminal/models/sharing.py:88 #: xpack/plugins/change_auth_plan/models/base.py:187 #: xpack/plugins/cloud/models.py:176 msgid "Reason" @@ -1212,33 +1210,33 @@ msgstr "状态名称" msgid "MFA display" msgstr "多因子认证" -#: audits/serializers.py:75 audits/serializers.py:90 ops/models/adhoc.py:248 +#: audits/serializers.py:76 audits/serializers.py:91 ops/models/adhoc.py:248 #: terminal/serializers/session.py:35 msgid "Is success" msgstr "是否成功" -#: audits/serializers.py:77 +#: audits/serializers.py:78 msgid "Hosts display" msgstr "主机名称" -#: audits/serializers.py:89 ops/models/command.py:26 +#: audits/serializers.py:90 ops/models/command.py:26 #: xpack/plugins/cloud/models.py:170 msgid "Result" msgstr "结果" -#: audits/serializers.py:91 terminal/serializers/storage.py:151 +#: audits/serializers.py:92 terminal/serializers/storage.py:151 msgid "Hosts" msgstr "主机" -#: audits/serializers.py:92 +#: audits/serializers.py:93 msgid "Run as" msgstr "运行用户" -#: audits/serializers.py:94 +#: audits/serializers.py:95 msgid "Run as display" msgstr "运行用户名称" -#: audits/serializers.py:95 +#: audits/serializers.py:96 msgid "User display" msgstr "用户名称" @@ -1254,13 +1252,13 @@ msgstr "" msgid "Auth Token" msgstr "认证令牌" -#: audits/signals_handler.py:68 authentication/views/login.py:169 -#: notifications/backends/__init__.py:11 users/models/user.py:659 +#: audits/signals_handler.py:68 authentication/views/login.py:168 +#: notifications/backends/__init__.py:11 users/models/user.py:652 msgid "WeCom" msgstr "企业微信" -#: audits/signals_handler.py:69 authentication/views/login.py:175 -#: notifications/backends/__init__.py:12 users/models/user.py:660 +#: audits/signals_handler.py:69 authentication/views/login.py:174 +#: notifications/backends/__init__.py:12 users/models/user.py:653 msgid "DingTalk" msgstr "钉钉" @@ -1630,30 +1628,31 @@ msgstr "登录复核 {}" msgid "IP is not allowed" msgstr "来源 IP 不被允许登录" +#: authentication/errors.py:268 msgid "Time Period is not allowed" msgstr "该 时间段 不被允许登录" -#: authentication/errors.py:294 +#: authentication/errors.py:301 msgid "SSO auth closed" msgstr "SSO 认证关闭了" -#: authentication/errors.py:299 authentication/mixins.py:338 +#: authentication/errors.py:306 authentication/mixins.py:340 msgid "Your password is too simple, please change it for security" msgstr "你的密码过于简单,为了安全,请修改" -#: authentication/errors.py:308 authentication/mixins.py:345 +#: authentication/errors.py:315 authentication/mixins.py:347 msgid "You should to change your password before login" msgstr "登录完成前,请先修改密码" -#: authentication/errors.py:317 authentication/mixins.py:352 +#: authentication/errors.py:324 authentication/mixins.py:354 msgid "Your password has expired, please reset before logging in" msgstr "您的密码已过期,先修改再登录" -#: authentication/errors.py:351 +#: authentication/errors.py:358 msgid "Your password is invalid" msgstr "您的密码无效" -#: authentication/errors.py:357 +#: authentication/errors.py:364 msgid "No upload or download permission" msgstr "没有上传下载权限" @@ -1677,31 +1676,23 @@ msgstr "多因子认证验证码" msgid "Dynamic code" msgstr "动态码" -#: authentication/mixins.py:328 +#: authentication/mixins.py:330 msgid "Please change your password" msgstr "请修改密码" -#: authentication/mixins.py:514 +#: authentication/mixins.py:515 msgid "SMS" msgstr "短信" -#: authentication/models.py:40 +#: authentication/models.py:37 msgid "Private Token" msgstr "SSH密钥" -#: authentication/models.py:49 settings/serializers/security.py:144 -msgid "Login Confirm" -msgstr "登录复核" - -#: authentication/models.py:90 -msgid "{} need confirm by {}" -msgstr "{} 需要 {} 复核" - -#: authentication/models.py:99 +#: authentication/models.py:46 msgid "Expired" msgstr "过期时间" -#: authentication/notifications.py:19 +#: authentication/notifications.py:20 msgid "Different city login reminder" msgstr "异地登录提醒" @@ -1749,14 +1740,14 @@ msgid "Show" msgstr "显示" #: authentication/templates/authentication/_access_key_modal.html:66 -#: settings/serializers/security.py:25 users/models/user.py:469 +#: settings/serializers/security.py:25 users/models/user.py:462 #: users/serializers/profile.py:99 #: users/templates/users/user_verify_mfa.html:32 msgid "Disable" msgstr "禁用" #: authentication/templates/authentication/_access_key_modal.html:67 -#: users/models/user.py:470 users/serializers/profile.py:100 +#: users/models/user.py:463 users/serializers/profile.py:100 msgid "Enable" msgstr "启用" @@ -2007,12 +1998,12 @@ msgstr "正在跳转到 {} 认证" msgid "Please enable cookies and try again." msgstr "设置你的浏览器支持cookie" -#: authentication/views/login.py:181 notifications/backends/__init__.py:14 -#: users/models/user.py:661 +#: authentication/views/login.py:180 notifications/backends/__init__.py:14 +#: users/models/user.py:654 msgid "FeiShu" msgstr "飞书" -#: authentication/views/login.py:269 +#: authentication/views/login.py:268 msgid "" "Wait for {} confirm, You also can copy link to her/him
\n" " Don't close this page" @@ -2020,15 +2011,15 @@ msgstr "" "等待 {} 确认, 你也可以复制链接发给他/她
\n" " 不要关闭本页面" -#: authentication/views/login.py:274 +#: authentication/views/login.py:273 msgid "No ticket found" msgstr "没有发现工单" -#: authentication/views/login.py:306 +#: authentication/views/login.py:305 msgid "Logout success" msgstr "退出登录成功" -#: authentication/views/login.py:307 +#: authentication/views/login.py:306 msgid "Logout success, return login page" msgstr "退出登录成功,返回到登录页面" @@ -2151,46 +2142,46 @@ msgstr "编码数据为 text" msgid "Encrypt field using Secret Key" msgstr "加密的字段" -#: common/message/backends/exceptions.py:23 +#: common/mixins/api/action.py:53 +msgid "Request file format may be wrong" +msgstr "上传的文件格式错误 或 其它类型资源的文件" + +#: common/mixins/models.py:33 +msgid "is discard" +msgstr "忽略的" + +#: common/mixins/models.py:34 +msgid "discard time" +msgstr "忽略时间" + +#: common/sdk/im/exceptions.py:23 msgid "Network error, please contact system administrator" msgstr "网络错误,请联系系统管理员" -#: common/message/backends/sms/__init__.py:15 +#: common/sdk/im/wecom/__init__.py:15 +msgid "WeCom error, please contact system administrator" +msgstr "企业微信错误,请联系系统管理员" + +#: common/sdk/sms/__init__.py:15 msgid "Alibaba cloud" msgstr "阿里云" -#: common/message/backends/sms/__init__.py:16 +#: common/sdk/sms/__init__.py:16 msgid "Tencent cloud" msgstr "腾讯云" -#: common/message/backends/sms/__init__.py:42 +#: common/sdk/sms/__init__.py:42 msgid "SMS provider not support: {}" msgstr "短信服务商不支持:{}" -#: common/message/backends/sms/__init__.py:63 +#: common/sdk/sms/__init__.py:63 msgid "SMS verification code signature or template invalid" msgstr "短信验证码签名或模版无效" -#: common/message/backends/sms/alibaba.py:56 +#: common/sdk/sms/alibaba.py:56 msgid "Signature does not match" msgstr "签名不匹配" -#: common/message/backends/wecom/__init__.py:15 -msgid "WeCom error, please contact system administrator" -msgstr "企业微信错误,请联系系统管理员" - -#: common/mixins/api.py:58 -msgid "Request file format may be wrong" -msgstr "上传的文件格式错误 或 其它类型资源的文件" - -#: common/mixins/models.py:33 -msgid "is discard" -msgstr "忽略的" - -#: common/mixins/models.py:34 -msgid "discard time" -msgstr "忽略时间" - #: common/utils/geoip/utils.py:17 common/utils/geoip/utils.py:30 msgid "Invalid ip" msgstr "无效IP" @@ -2247,7 +2238,7 @@ msgstr "" "div>" #: notifications/backends/__init__.py:10 users/forms/profile.py:101 -#: users/models/user.py:606 +#: users/models/user.py:599 msgid "Email" msgstr "邮件" @@ -2255,7 +2246,7 @@ msgstr "邮件" msgid "Site message" msgstr "站内信" -#: notifications/notifications.py:147 ops/models/adhoc.py:246 +#: notifications/notifications.py:148 ops/models/adhoc.py:246 #: xpack/plugins/change_auth_plan/models/base.py:108 #: xpack/plugins/change_auth_plan/models/base.py:190 #: xpack/plugins/gathered_user/models.py:79 @@ -2458,7 +2449,7 @@ msgstr "组织审计员" msgid "GLOBAL" msgstr "全局组织" -#: orgs/models.py:434 users/models/user.py:614 users/serializers/user.py:37 +#: orgs/models.py:434 users/models/user.py:607 users/serializers/user.py:37 #: users/templates/users/_select_user_modal.html:15 msgid "Role" msgstr "角色" @@ -2471,7 +2462,7 @@ msgstr "管理员正在修改授权,请稍等" msgid "The authorization cannot be revoked for the time being" msgstr "该授权暂时不能撤销" -#: perms/models/application_permission.py:27 users/models/user.py:181 +#: perms/models/application_permission.py:27 users/models/user.py:174 msgid "Application" msgstr "应用程序" @@ -2523,7 +2514,7 @@ msgid "Favorite" msgstr "收藏夹" #: perms/models/base.py:47 templates/_nav.html:21 users/models/group.py:31 -#: users/models/user.py:610 users/templates/users/_select_user_modal.html:16 +#: users/models/user.py:603 users/templates/users/_select_user_modal.html:16 #: users/templates/users/user_asset_permission.html:39 #: users/templates/users/user_asset_permission.html:67 #: users/templates/users/user_database_app_permission.html:38 @@ -2534,7 +2525,7 @@ msgstr "用户组" #: perms/models/base.py:50 #: tickets/serializers/ticket/meta/ticket_type/apply_application.py:60 #: tickets/serializers/ticket/meta/ticket_type/apply_asset.py:50 -#: users/models/user.py:642 +#: users/models/user.py:635 msgid "Date expired" msgstr "失效日期" @@ -2542,35 +2533,35 @@ msgstr "失效日期" msgid "From ticket" msgstr "来自工单" -#: perms/notifications.py:21 +#: perms/notifications.py:19 msgid "You permed assets is about to expire" msgstr "你授权的资产即将到期" -#: perms/notifications.py:25 +#: perms/notifications.py:23 msgid "permed assets" msgstr "授权的资产" -#: perms/notifications.py:63 +#: perms/notifications.py:61 msgid "Asset permissions is about to expire" msgstr "资产授权规则将要过期" -#: perms/notifications.py:67 +#: perms/notifications.py:65 msgid "asset permissions of organization {}" msgstr "组织 ({}) 的资产授权" -#: perms/notifications.py:93 +#: perms/notifications.py:91 msgid "Your permed applications is about to expire" msgstr "你授权的应用即将过期" -#: perms/notifications.py:96 +#: perms/notifications.py:94 msgid "permed applications" msgstr "授权的应用" -#: perms/notifications.py:134 +#: perms/notifications.py:132 msgid "Application permissions is about to expire" msgstr "应用授权规则即将过期" -#: perms/notifications.py:137 +#: perms/notifications.py:135 msgid "application permissions of organization {}" msgstr "组织 ({}) 的应用授权" @@ -2584,7 +2575,7 @@ msgstr "账户是否有效" #: perms/serializers/application/permission.py:19 #: perms/serializers/application/permission.py:37 #: perms/serializers/asset/permission.py:43 -#: perms/serializers/asset/permission.py:67 users/serializers/user.py:29 +#: perms/serializers/asset/permission.py:67 users/serializers/user.py:28 #: users/serializers/user.py:79 msgid "Is expired" msgstr "已过期" @@ -3362,10 +3353,6 @@ msgstr "会话分享" msgid "Enabled, Allows user active session to be shared with other users" msgstr "开启后允许用户分享已连接的资产会话给它人,协同工作" -#: settings/serializers/security.py:145 -msgid "Enabled, please go to the user detail add approver" -msgstr "启用后, 请在用户详情中添加审批人" - #: settings/serializers/sms.py:7 msgid "Label" msgstr "标签" @@ -4284,7 +4271,7 @@ msgstr "是否可加入" msgid "Can terminate" msgstr "是否可中断" -#: terminal/serializers/session.py:50 +#: terminal/serializers/session.py:45 msgid "Command amount" msgstr "命令数量" @@ -4353,12 +4340,16 @@ msgstr "文档类型" msgid "Ignore Certificate Verification" msgstr "忽略证书认证" -#: terminal/serializers/terminal.py:80 terminal/serializers/terminal.py:88 +#: terminal/serializers/terminal.py:44 +msgid "Load status" +msgstr "" + +#: terminal/serializers/terminal.py:83 terminal/serializers/terminal.py:91 msgid "Not found" msgstr "没有发现" #: terminal/templates/terminal/_msg_command_alert.html:13 -#: terminal/templates/terminal/_msg_command_execue_alert.html:7 +#: terminal/templates/terminal/_msg_command_execute_alert.html:7 msgid "Level" msgstr "级别" @@ -4618,22 +4609,22 @@ msgstr "流程" msgid "TicketFlow" msgstr "工单流程" -#: tickets/notifications.py:46 -msgid "New Ticket - {} ({})" -msgstr "新工单 - {} ({})" - -#: tickets/notifications.py:54 +#: tickets/notifications.py:56 msgid "Your has a new ticket, applicant - {}" msgstr "你有一个新的工单, 申请人 - {}" -#: tickets/notifications.py:68 -msgid "Ticket has processed - {} ({})" -msgstr "你的工单已被处理, 处理人 - {} ({})" +#: tickets/notifications.py:62 +msgid "New Ticket - {} ({})" +msgstr "新工单 - {} ({})" -#: tickets/notifications.py:77 +#: tickets/notifications.py:84 msgid "Your ticket has been processed, processor - {}" msgstr "你的工单已被处理, 处理人 - {}" +#: tickets/notifications.py:88 +msgid "Ticket has processed - {} ({})" +msgstr "你的工单已被处理, 处理人 - {} ({})" + #: tickets/serializers/ticket/meta/ticket_type/apply_application.py:20 #: tickets/serializers/ticket/meta/ticket_type/apply_asset.py:18 msgid "Apply name" @@ -4751,20 +4742,18 @@ msgid "The current organization type already exists" msgstr "当前组织已存在该类型" #: tickets/templates/tickets/_msg_ticket.html:11 -#, fuzzy -#| msgid "click here to review" msgid "Click here to review" msgstr "点击查看" -#: users/api/user.py:208 +#: users/api/user.py:207 msgid "Could not reset self otp, use profile reset instead" msgstr "不能在该页面重置多因子认证, 请去个人信息页面重置" -#: users/const.py:10 users/models/user.py:178 +#: users/const.py:10 users/models/user.py:171 msgid "System administrator" msgstr "系统管理员" -#: users/const.py:11 users/models/user.py:179 +#: users/const.py:11 users/models/user.py:172 msgid "System auditor" msgstr "系统审计员" @@ -4859,7 +4848,7 @@ msgstr "不能和原来的密钥相同" msgid "Not a valid ssh public key" msgstr "SSH密钥不合法" -#: users/forms/profile.py:160 users/models/user.py:634 +#: users/forms/profile.py:160 users/models/user.py:627 #: users/templates/users/user_password_update.html:48 msgid "Public key" msgstr "SSH公钥" @@ -4872,43 +4861,43 @@ msgstr "一次性密码" msgid "SMS verify code" msgstr "短信验证码" -#: users/models/user.py:471 +#: users/models/user.py:464 msgid "Force enable" msgstr "强制启用" -#: users/models/user.py:583 +#: users/models/user.py:576 msgid "Local" msgstr "数据库" -#: users/models/user.py:617 +#: users/models/user.py:610 msgid "Avatar" msgstr "头像" -#: users/models/user.py:620 +#: users/models/user.py:613 msgid "Wechat" msgstr "微信" -#: users/models/user.py:631 +#: users/models/user.py:624 msgid "Private key" msgstr "ssh私钥" -#: users/models/user.py:650 +#: users/models/user.py:643 msgid "Source" msgstr "来源" -#: users/models/user.py:654 +#: users/models/user.py:647 msgid "Date password last updated" msgstr "最后更新密码日期" -#: users/models/user.py:657 +#: users/models/user.py:650 msgid "Need update password" msgstr "需要更新密码" -#: users/models/user.py:821 +#: users/models/user.py:809 msgid "Administrator" msgstr "管理员" -#: users/models/user.py:824 +#: users/models/user.py:812 msgid "Administrator is the super user of system" msgstr "Administrator是初始的超级管理员" @@ -4959,33 +4948,33 @@ msgstr "两次密码不一致" msgid "Is first login" msgstr "首次登录" -#: users/serializers/user.py:23 +#: users/serializers/user.py:22 #: xpack/plugins/change_auth_plan/models/base.py:32 #: xpack/plugins/change_auth_plan/serializers/base.py:24 msgid "Password strategy" msgstr "密码策略" -#: users/serializers/user.py:25 +#: users/serializers/user.py:24 msgid "MFA enabled" msgstr "MFA" -#: users/serializers/user.py:26 +#: users/serializers/user.py:25 msgid "MFA force enabled" msgstr "强制 MFA" -#: users/serializers/user.py:27 +#: users/serializers/user.py:26 msgid "MFA level display" msgstr "MFA 等级名称" -#: users/serializers/user.py:28 +#: users/serializers/user.py:27 msgid "Login blocked" msgstr "登录被阻塞" -#: users/serializers/user.py:30 +#: users/serializers/user.py:29 msgid "Can update" msgstr "是否可更新" -#: users/serializers/user.py:31 +#: users/serializers/user.py:30 msgid "Can delete" msgstr "是否可删除" @@ -5037,7 +5026,7 @@ msgstr "是否绑定了虚拟MFA" msgid "Role limit to {}" msgstr "角色只能为 {}" -#: users/serializers/user.py:235 +#: users/serializers/user.py:227 msgid "name not unique" msgstr "名称重复" @@ -5994,6 +5983,21 @@ msgstr "旗舰版" msgid "Community edition" msgstr "社区版" +#~ msgid "Login IP" +#~ msgstr "登录IP" + +#~ msgid "The user `{}` is not in the current organization: `{}`" +#~ msgstr "用户 `{}` 不在当前组织: `{}`" + +#~ msgid "Login Confirm" +#~ msgstr "登录复核" + +#~ msgid "{} need confirm by {}" +#~ msgstr "{} 需要 {} 复核" + +#~ msgid "Enabled, please go to the user detail add approver" +#~ msgstr "启用后, 请在用户详情中添加审批人" + #~ msgid "" #~ "\n" #~ "Time: {}" diff --git a/apps/perms/notifications.py b/apps/perms/notifications.py index a8319b92f..4971e7134 100644 --- a/apps/perms/notifications.py +++ b/apps/perms/notifications.py @@ -6,13 +6,7 @@ from common.utils import reverse as js_reverse from notifications.notifications import UserMessage -class BasePermMsg(UserMessage): - @classmethod - def gen_test_msg(cls): - return - - -class PermedWillExpireUserMsg(BasePermMsg): +class PermedWillExpireUserMsg(UserMessage): def __init__(self, user, assets): super().__init__(user) self.assets = assets @@ -40,7 +34,7 @@ class PermedWillExpireUserMsg(BasePermMsg): return cls(user, assets) -class AssetPermsWillExpireForOrgAdminMsg(BasePermMsg): +class AssetPermsWillExpireForOrgAdminMsg(UserMessage): def __init__(self, user, perms, org): super().__init__(user) @@ -84,7 +78,7 @@ class AssetPermsWillExpireForOrgAdminMsg(BasePermMsg): return cls(user, perms, org) -class PermedAppsWillExpireUserMsg(BasePermMsg): +class PermedAppsWillExpireUserMsg(UserMessage): def __init__(self, user, apps): super().__init__(user) self.apps = apps @@ -112,7 +106,7 @@ class PermedAppsWillExpireUserMsg(BasePermMsg): return cls(user, apps) -class AppPermsWillExpireForOrgAdminMsg(BasePermMsg): +class AppPermsWillExpireForOrgAdminMsg(UserMessage): def __init__(self, user, perms, org): super().__init__(user) self.perms = perms diff --git a/apps/tickets/handler/apply_application.py b/apps/tickets/handler/apply_application.py index 61ef64258..9a504f39f 100644 --- a/apps/tickets/handler/apply_application.py +++ b/apps/tickets/handler/apply_application.py @@ -43,11 +43,11 @@ class Handler(BaseHandler): apply_date_start = self.ticket.meta.get('apply_date_start') apply_date_expired = self.ticket.meta.get('apply_date_expired') applied_body = '''{}: {}, - {}: {}, - {}: {}, - {}: {}, - {}: {}, - {}: {}, + {}: {} + {}: {} + {}: {} + {}: {} + {}: {} '''.format( _('Applied category'), apply_category_display, _('Applied type'), apply_type_display, diff --git a/apps/tickets/handler/apply_asset.py b/apps/tickets/handler/apply_asset.py index 584f3a12b..883c7f45b 100644 --- a/apps/tickets/handler/apply_asset.py +++ b/apps/tickets/handler/apply_asset.py @@ -69,10 +69,10 @@ class Handler(BaseHandler): str(self.ticket.__class__.__name__), str(self.ticket.id) ) permission_comment = _( - 'Created by the ticket, ' - 'ticket title: {}, ' - 'ticket applicant: {}, ' - 'ticket processor: {}, ' + 'Created by the ticket ' + 'ticket title: {} ' + 'ticket applicant: {} ' + 'ticket processor: {} ' 'ticket ID: {}' ).format( self.ticket.title, diff --git a/apps/tickets/handler/base.py b/apps/tickets/handler/base.py index e308d7255..a5b2efdc6 100644 --- a/apps/tickets/handler/base.py +++ b/apps/tickets/handler/base.py @@ -105,28 +105,29 @@ class BaseHandler(object): return basic_body + meta_body def _construct_basic_body(self): - basic_body = '''{}: {}, - {}: {}, - {}: {}, - {}: {}, + basic_body = ''' + {}: {} + {}: {} + {}: {} + {}: {} '''.format( _('Ticket title'), self.ticket.title, _('Ticket type'), self.ticket.get_type_display(), _('Ticket status'), self.ticket.get_status_display(), _('Ticket applicant'), self.ticket.applicant_display, - ) + ).strip() body = self.body_html_format.format(_("Ticket basic info"), basic_body) return body def _construct_meta_body(self): body = '' - open_body = self._base_construct_meta_body_of_open() + open_body = self._base_construct_meta_body_of_open().strip() body += open_body return body def _base_construct_meta_body_of_open(self): meta_body_of_open = getattr( self, '_construct_meta_body_of_open', lambda: _('No content') - )() + )().strip() body = self.body_html_format.format(_('Ticket applied info'), meta_body_of_open) return body diff --git a/apps/tickets/handler/command_confirm.py b/apps/tickets/handler/command_confirm.py index 2d66db2d8..6fb27dcfe 100644 --- a/apps/tickets/handler/command_confirm.py +++ b/apps/tickets/handler/command_confirm.py @@ -14,12 +14,13 @@ class Handler(BaseHandler): apply_from_cmd_filter_rule_id = self.ticket.meta.get('apply_from_cmd_filter_rule_id') apply_from_cmd_filter_id = self.ticket.meta.get('apply_from_cmd_filter_id') - applied_body = '''{}: {}, - {}: {}, - {}: {}, - {}: {}, - {}: {}, - {}: {}, + applied_body = ''' + {}: {} + {}: {} + {}: {} + {}: {} + {}: {} + {}: {} '''.format( _("Applied run user"), apply_run_user, _("Applied run asset"), apply_run_asset, diff --git a/apps/tickets/handler/login_asset_confirm.py b/apps/tickets/handler/login_asset_confirm.py index b967af29d..039f7ce50 100644 --- a/apps/tickets/handler/login_asset_confirm.py +++ b/apps/tickets/handler/login_asset_confirm.py @@ -9,8 +9,9 @@ class Handler(BaseHandler): apply_login_user = self.ticket.meta.get('apply_login_user') apply_login_asset = self.ticket.meta.get('apply_login_asset') apply_login_system_user = self.ticket.meta.get('apply_login_system_user') - applied_body = '''{}: {}, - {}: {}, + applied_body = ''' + {}: {} + {}: {} {}: {} '''.format( _("Applied login user"), apply_login_user, diff --git a/apps/tickets/handler/login_confirm.py b/apps/tickets/handler/login_confirm.py index b1d491cfc..65c46fb56 100644 --- a/apps/tickets/handler/login_confirm.py +++ b/apps/tickets/handler/login_confirm.py @@ -9,8 +9,9 @@ class Handler(BaseHandler): apply_login_ip = self.ticket.meta.get('apply_login_ip') apply_login_city = self.ticket.meta.get('apply_login_city') apply_login_datetime = self.ticket.meta.get('apply_login_datetime') - applied_body = '''{}: {}, - {}: {}, + applied_body = ''' + {}: {} + {}: {} {}: {} '''.format( _("Applied login IP"), apply_login_ip, diff --git a/apps/tickets/notifications.py b/apps/tickets/notifications.py index a8f3a5417..2df08845f 100644 --- a/apps/tickets/notifications.py +++ b/apps/tickets/notifications.py @@ -2,7 +2,7 @@ from urllib.parse import urljoin from django.conf import settings from django.template.loader import render_to_string -from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext_lazy as _ from . import const from notifications.notifications import UserMessage @@ -17,14 +17,18 @@ class BaseTicketMessage(UserMessage): ticket: Ticket content_title: str - @property - def subject(self): - return self.title.format(self.ticket.title, self.ticket.get_type_display()) - @property def ticket_detail_url(self): return urljoin(settings.SITE_URL, const.TICKET_DETAIL_URL.format(id=str(self.ticket.id))) + @property + def content_title(self): + raise NotImplementedError + + @property + def subject(self): + raise NotImplementedError + def get_html_msg(self) -> dict: context = dict( title=self.content_title, @@ -43,8 +47,6 @@ class BaseTicketMessage(UserMessage): class TicketAppliedToAssignee(BaseTicketMessage): - title = _('New Ticket - {} ({})') - def __init__(self, user, ticket): self.ticket = ticket super().__init__(user) @@ -55,6 +57,13 @@ class TicketAppliedToAssignee(BaseTicketMessage): str(self.ticket.applicant_display) ) + @property + def subject(self): + title = _('New Ticket - {} ({})').format( + self.ticket.title, self.ticket.get_type_display() + ) + return title + @classmethod def gen_test_msg(cls): from .models import Ticket @@ -65,8 +74,6 @@ class TicketAppliedToAssignee(BaseTicketMessage): class TicketProcessedToApplicant(BaseTicketMessage): - title = _('Ticket has processed - {} ({})') - def __init__(self, user, ticket, processor): self.ticket = ticket self.processor = processor @@ -76,6 +83,13 @@ class TicketProcessedToApplicant(BaseTicketMessage): def content_title(self): return _('Your ticket has been processed, processor - {}').format(str(self.processor)) + @property + def subject(self): + title = _('Ticket has processed - {} ({})').format( + self.ticket.title, self.ticket.get_type_display() + ) + return title + @classmethod def gen_test_msg(cls): from .models import Ticket diff --git a/apps/tickets/templates/tickets/_base_ticket_body.html b/apps/tickets/templates/tickets/_base_ticket_body.html new file mode 100644 index 000000000..593a1d35e --- /dev/null +++ b/apps/tickets/templates/tickets/_base_ticket_body.html @@ -0,0 +1,20 @@ +{% load i18n %} +
+

+ {{ ticket_info }} +

+
+

+

+

+ +

+ + {{ body | safe }} +
+
+ + {% trans 'Click here to review' %} + +
+
\ No newline at end of file diff --git a/apps/tickets/templates/tickets/_msg_ticket.html b/apps/tickets/templates/tickets/_msg_ticket.html index f789d2e9a..deba0d72a 100644 --- a/apps/tickets/templates/tickets/_msg_ticket.html +++ b/apps/tickets/templates/tickets/_msg_ticket.html @@ -6,6 +6,7 @@
{{ body | safe }}
+
{% trans 'Click here to review' %}