diff --git a/apps/accounts/serializers/account/virtual.py b/apps/accounts/serializers/account/virtual.py index 57d14a939..a1d107b20 100644 --- a/apps/accounts/serializers/account/virtual.py +++ b/apps/accounts/serializers/account/virtual.py @@ -22,7 +22,7 @@ class VirtualAccountSerializer(serializers.ModelSerializer): 'secret_from_login': { 'help_text': _( 'Current only support login from AD/LDAP. Secret priority: ' - 'Same account in asset secret > Login secret > Manual input. ' + 'Same account in asset secret > Login secret > Manual input.
' 'For security, please set config CACHE_LOGIN_PASSWORD_ENABLED to true' ) }, diff --git a/apps/locale/ja/LC_MESSAGES/django.mo b/apps/locale/ja/LC_MESSAGES/django.mo index 0fabb89d3..175ee764d 100644 --- a/apps/locale/ja/LC_MESSAGES/django.mo +++ b/apps/locale/ja/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:adfc307a827a5299030378017f8c1b840276711dcf1a0cf55d3bce47aafa0f1f -size 156109 +oid sha256:e73f77a5898c8626b05360d32778643c5b77502da22e90f956be0f6aa2a45aa4 +size 156006 diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index 5ddf47c27..973618e8e 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-30 15:59+0800\n" +"POT-Creation-Date: 2023-08-28 10:55+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -823,12 +823,12 @@ msgstr "コメント" #: accounts/serializers/account/virtual.py:24 msgid "" "Current only support login from AD/LDAP. Secret priority: Same account in " -"asset secret > Login secret > Manual input. For security, please set config " -"CACHE_LOGIN_PASSWORD_ENABLED to true" +"asset secret > Login secret > Manual input.
For security, please set " +"config CACHE_LOGIN_PASSWORD_ENABLED to true" msgstr "" "現在、AD/LDAPからのログインのみをサポートしています。シークレットの優先順位: " -"資産シークレット内の同じアカウント > ログインシークレット > 手動入力, セキュ" -"リティのために、コンフィギュレーション項目CACHE _LOGIN_PASSWORD_ENABLEDはtrue" +"資産シークレット内の同じアカウント > ログインシークレット > 手動入力.
" +"セキュリティのために、「config CACHE_LOGIN_PASSWORD_ENABLED」をtrueに設定してください。 " #: accounts/serializers/automations/base.py:23 #: assets/models/asset/common.py:155 assets/models/automations/base.py:18 @@ -1240,8 +1240,8 @@ msgid "Cloud service" msgstr "クラウド サービス" #: assets/const/category.py:14 assets/models/asset/gpt.py:11 -#: assets/models/asset/web.py:16 audits/const.py:35 -#: terminal/models/applet/applet.py:27 +#: assets/models/asset/web.py:16 audits/const.py:34 +#: terminal/models/applet/applet.py:26 msgid "Web" msgstr "Web" @@ -6037,8 +6037,8 @@ msgstr "一括作成非サポート" msgid "Storage is invalid" msgstr "ストレージが無効です" -#: terminal/models/applet/applet.py:30 xpack/plugins/license/models.py:86 -msgid "Community Edition" +#: terminal/models/applet/applet.py:29 +msgid "Community" msgstr "コミュニティ版" #: terminal/models/applet/applet.py:31 diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index ff1956dce..117c01128 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:20793cf634d9d59e0c1e1b903712223422dd42e1b7f6b7859015e0b83aaa4a96 -size 127733 +oid sha256:0b96e0625afb1562c735097ed1ed4e5a0a5496e4578b208dd2ed24a67928ceb2 +size 127664 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 8d05be53b..602b7ac31 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-30 15:59+0800\n" +"POT-Creation-Date: 2023-08-28 10:55+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -92,7 +92,7 @@ msgid "Update" msgstr "更新" #: accounts/const/account.py:33 -#: accounts/serializers/automations/change_secret.py:156 audits/const.py:55 +#: accounts/serializers/automations/change_secret.py:156 audits/const.py:54 #: audits/signal_handlers/activity_log.py:33 common/const/choices.py:19 #: ops/const.py:61 terminal/const.py:77 xpack/plugins/cloud/const.py:43 msgid "Failed" @@ -244,7 +244,7 @@ msgstr "切换自" #: accounts/models/account.py:54 assets/const/protocol.py:162 #: settings/serializers/auth/cas.py:20 settings/serializers/auth/feishu.py:20 -#: terminal/models/applet/applet.py:35 +#: terminal/models/applet/applet.py:34 msgid "Version" msgstr "版本" @@ -348,56 +348,56 @@ msgstr "是否成功" msgid "Account backup execution" msgstr "账号备份执行" -#: accounts/models/automations/base.py:19 +#: accounts/models/automations/base.py:20 msgid "Account automation task" msgstr "账号自动化任务" -#: accounts/models/automations/base.py:33 +#: accounts/models/automations/base.py:34 msgid "Automation execution" msgstr "自动化执行" -#: accounts/models/automations/base.py:34 +#: accounts/models/automations/base.py:35 msgid "Automation executions" msgstr "自动化执行" -#: accounts/models/automations/base.py:36 +#: accounts/models/automations/base.py:37 msgid "Can view change secret execution" msgstr "查看改密执行" -#: accounts/models/automations/base.py:37 +#: accounts/models/automations/base.py:38 msgid "Can add change secret execution" msgstr "创建改密执行" -#: accounts/models/automations/base.py:39 +#: accounts/models/automations/base.py:40 msgid "Can view gather accounts execution" msgstr "查看收集账号执行" -#: accounts/models/automations/base.py:40 +#: accounts/models/automations/base.py:41 msgid "Can add gather accounts execution" msgstr "创建收集账号执行" -#: accounts/models/automations/base.py:42 +#: accounts/models/automations/base.py:43 msgid "Can view push account execution" msgstr "查看推送账号执行" -#: accounts/models/automations/base.py:43 +#: accounts/models/automations/base.py:44 msgid "Can add push account execution" msgstr "创建推送账号执行" -#: accounts/models/automations/base.py:55 accounts/models/template.py:21 +#: accounts/models/automations/base.py:56 accounts/models/template.py:21 #: accounts/serializers/automations/change_secret.py:40 msgid "Secret strategy" msgstr "密文策略" -#: accounts/models/automations/base.py:57 +#: accounts/models/automations/base.py:58 msgid "Password rules" msgstr "密码规则" -#: accounts/models/automations/base.py:60 +#: accounts/models/automations/base.py:61 msgid "SSH key change strategy" msgstr "SSH 密钥推送方式" -#: accounts/models/automations/base.py:70 accounts/models/base.py:36 +#: accounts/models/automations/base.py:71 accounts/models/base.py:36 #: accounts/serializers/account/account.py:429 #: accounts/serializers/account/base.py:16 #: accounts/serializers/automations/change_secret.py:46 @@ -406,7 +406,7 @@ msgstr "SSH 密钥推送方式" msgid "Secret type" msgstr "密文类型" -#: accounts/models/automations/base.py:72 accounts/models/mixins/vault.py:48 +#: accounts/models/automations/base.py:73 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 @@ -527,7 +527,7 @@ msgstr "账号验证" #: ops/models/job.py:126 ops/models/playbook.py:28 ops/serializers/job.py:20 #: orgs/models.py:82 perms/models/asset_permission.py:56 rbac/models/role.py:29 #: settings/models.py:32 settings/serializers/msg.py:82 -#: terminal/models/applet/applet.py:33 terminal/models/component/endpoint.py:12 +#: terminal/models/applet/applet.py:32 terminal/models/component/endpoint.py:12 #: terminal/models/component/endpoint.py:94 #: terminal/models/component/storage.py:26 terminal/models/component/task.py:13 #: terminal/models/component/terminal.py:84 users/forms/profile.py:33 @@ -545,7 +545,7 @@ msgstr "特权账号" #: assets/models/automations/base.py:21 assets/models/cmd_filter.py:39 #: assets/models/label.py:22 #: authentication/serializers/connect_token_secret.py:114 -#: terminal/models/applet/applet.py:40 +#: terminal/models/applet/applet.py:39 #: terminal/models/component/endpoint.py:105 users/serializers/user.py:170 msgid "Is active" msgstr "激活" @@ -668,7 +668,7 @@ msgstr "类别" #: assets/serializers/asset/common.py:122 assets/serializers/platform.py:112 #: assets/serializers/platform.py:127 audits/serializers.py:49 #: authentication/serializers/connect_token_secret.py:123 ops/models/job.py:137 -#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:39 +#: perms/serializers/user_permission.py:27 terminal/models/applet/applet.py:38 #: terminal/models/component/storage.py:57 #: terminal/models/component/storage.py:146 terminal/serializers/applet.py:29 #: terminal/serializers/session.py:21 terminal/serializers/storage.py:226 @@ -808,8 +808,8 @@ msgstr "关联平台,可配置推送参数,如果不关联,将使用默认 #: assets/models/cmd_filter.py:40 assets/models/cmd_filter.py:88 #: assets/models/group.py:20 common/db/models.py:36 ops/models/adhoc.py:26 #: ops/models/job.py:145 ops/models/playbook.py:31 rbac/models/role.py:37 -#: settings/models.py:37 terminal/models/applet/applet.py:45 -#: terminal/models/applet/applet.py:302 terminal/models/applet/host.py:142 +#: settings/models.py:37 terminal/models/applet/applet.py:44 +#: terminal/models/applet/applet.py:284 terminal/models/applet/host.py:142 #: terminal/models/component/endpoint.py:24 #: terminal/models/component/endpoint.py:104 #: terminal/models/session/session.py:46 tickets/models/comment.py:32 @@ -818,15 +818,14 @@ msgstr "关联平台,可配置推送参数,如果不关联,将使用默认 msgid "Comment" msgstr "备注" -#: accounts/serializers/account/virtual.py:24 +#: accounts/serializers/account/virtual.py:22 msgid "" "Current only support login from AD/LDAP. Secret priority: Same account in " -"asset secret > Login secret > Manual input. For security, please set config " -"CACHE_LOGIN_PASSWORD_ENABLED to true" +"asset secret > Login secret > Manual input.
For security, please set " +"config CACHE_LOGIN_PASSWORD_ENABLED to true" msgstr "" "当前仅支持 AD/LDAP 登录方式用户。 同名账号密码生效顺序: 资产上存在的同名账号" -"密码 > 登录密码 > 手动输入, 为了安全起见,请设置配置项 " -"CACHE_LOGIN_PASSWORD_ENABLED 为 true" +"密码 > 登录密码 > 手动输入
为了安全起见,请设置配置项 CACHE_LOGIN_PASSWORD_ENABLED=true,重启服务才能开启" #: accounts/serializers/automations/base.py:23 #: assets/models/asset/common.py:155 assets/models/automations/base.py:18 @@ -862,7 +861,7 @@ msgstr "* 密码长度范围 6-30 位" msgid "Automation task execution" msgstr "自动化任务执行历史" -#: accounts/serializers/automations/change_secret.py:155 audits/const.py:54 +#: accounts/serializers/automations/change_secret.py:155 audits/const.py:53 #: audits/models.py:59 audits/signal_handlers/activity_log.py:33 #: common/const/choices.py:18 ops/const.py:59 ops/serializers/celery.py:40 #: terminal/const.py:76 terminal/models/session/sharing.py:121 @@ -870,8 +869,8 @@ msgstr "自动化任务执行历史" msgid "Success" msgstr "成功" -#: accounts/signal_handlers.py:46 -#, python-format +#: accounts/signal_handlers.py:47 +#, fpython-format msgid "Push related accounts to assets: %s, by system" msgstr "推送账号到资产: %s, 由系统执行" @@ -1182,7 +1181,7 @@ msgstr "认证失败" msgid "Connect failed" msgstr "连接失败" -#: assets/const/automation.py:6 audits/const.py:6 audits/const.py:37 +#: assets/const/automation.py:6 audits/const.py:6 audits/const.py:36 #: audits/signal_handlers/activity_log.py:62 common/utils/ip/geoip/utils.py:31 #: common/utils/ip/geoip/utils.py:37 common/utils/ip/utils.py:104 msgid "Unknown" @@ -1204,7 +1203,7 @@ msgstr "测试网关" msgid "Gather facts" msgstr "收集资产信息" -#: assets/const/base.py:33 audits/const.py:48 +#: assets/const/base.py:33 audits/const.py:47 #: terminal/serializers/applet_host.py:32 msgid "Disabled" msgstr "禁用" @@ -1235,8 +1234,8 @@ msgid "Cloud service" msgstr "云服务" #: assets/const/category.py:14 assets/models/asset/gpt.py:11 -#: assets/models/asset/web.py:16 audits/const.py:35 -#: terminal/models/applet/applet.py:27 +#: assets/models/asset/web.py:16 audits/const.py:34 +#: terminal/models/applet/applet.py:26 msgid "Web" msgstr "Web" @@ -1256,7 +1255,7 @@ msgstr "私有云" msgid "Kubernetes" msgstr "Kubernetes" -#: assets/const/device.py:7 terminal/models/applet/applet.py:26 +#: assets/const/device.py:7 terminal/models/applet/applet.py:25 #: tickets/const.py:8 msgid "General" msgstr "一般" @@ -1450,7 +1449,7 @@ msgstr "用户名与用户相同" #: assets/models/_user.py:52 authentication/models/connection_token.py:41 #: authentication/serializers/connect_token_secret.py:111 -#: terminal/models/applet/applet.py:42 terminal/serializers/session.py:19 +#: terminal/models/applet/applet.py:41 terminal/serializers/session.py:19 #: terminal/serializers/session.py:42 terminal/serializers/storage.py:70 msgid "Protocol" msgstr "协议" @@ -1589,7 +1588,7 @@ msgstr "资产自动化任务" #: assets/models/automations/base.py:113 audits/models.py:199 #: audits/serializers.py:50 ops/models/base.py:49 ops/models/job.py:220 -#: terminal/models/applet/applet.py:301 terminal/models/applet/host.py:139 +#: terminal/models/applet/applet.py:283 terminal/models/applet/host.py:139 #: 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 @@ -1734,7 +1733,7 @@ msgstr "开放的" msgid "Setting" msgstr "设置" -#: assets/models/platform.py:38 audits/const.py:49 settings/models.py:36 +#: assets/models/platform.py:38 audits/const.py:48 settings/models.py:36 #: terminal/serializers/applet_host.py:33 msgid "Enabled" msgstr "启用" @@ -2137,8 +2136,7 @@ msgstr "重命名" msgid "Symlink" msgstr "建立软链接" -#: audits/const.py:18 audits/const.py:28 perms/const.py:14 -#: terminal/api/session/session.py:141 +#: audits/const.py:18 perms/const.py:14 msgid "Download" msgstr "下载" @@ -2146,7 +2144,7 @@ msgstr "下载" msgid "Rename dir" msgstr "映射目录" -#: audits/const.py:23 rbac/tree.py:232 terminal/api/session/session.py:234 +#: audits/const.py:23 rbac/tree.py:232 #: terminal/templates/terminal/_msg_command_warning.html:18 #: terminal/templates/terminal/_msg_session_sharing.html:10 msgid "View" @@ -2158,7 +2156,7 @@ msgstr "查看" msgid "Create" msgstr "创建" -#: audits/const.py:29 perms/const.py:12 +#: audits/const.py:28 perms/const.py:12 msgid "Connect" msgstr "连接" @@ -5952,8 +5950,8 @@ msgstr "不支持批量创建" msgid "Storage is invalid" msgstr "存储无效" -#: terminal/models/applet/applet.py:30 xpack/plugins/license/models.py:86 -msgid "Community Edition" +#: terminal/models/applet/applet.py:29 +msgid "Community" msgstr "社区版" #: terminal/models/applet/applet.py:31 @@ -7747,7 +7745,7 @@ msgstr "规则值" #: xpack/plugins/cloud/models.py:317 xpack/plugins/cloud/serializers/task.py:70 msgid "Strategy rule" -msgstr "策略规则" +msgstr "条件" #: xpack/plugins/cloud/models.py:332 msgid "Action attr" @@ -7759,7 +7757,7 @@ msgstr "动作值" #: xpack/plugins/cloud/models.py:341 xpack/plugins/cloud/serializers/task.py:73 msgid "Strategy action" -msgstr "策略动作" +msgstr "动作" #: xpack/plugins/cloud/providers/aws_international.py:18 msgid "China (Beijing)" diff --git a/apps/terminal/api/session/session.py b/apps/terminal/api/session/session.py index 7277cdd9e..d3deaf172 100644 --- a/apps/terminal/api/session/session.py +++ b/apps/terminal/api/session/session.py @@ -90,7 +90,7 @@ class SessionViewSet(RecordViewLogMixin, OrgBulkModelViewSet): ] extra_filter_backends = [DatetimeRangeFilterBackend] rbac_perms = { - 'download': ['terminal.download_sessionreplay'] + 'download': ['terminal.download_sessionreplay'], } permission_classes = [RBACPermission | IsSessionAssignee] @@ -146,8 +146,26 @@ class SessionViewSet(RecordViewLogMixin, OrgBulkModelViewSet): ) return response + @action(methods=[GET], detail=False, permission_classes=[IsAuthenticated], url_path='online-info', ) + def online_info(self, request, *args, **kwargs): + asset = self.request.query_params.get('asset_id') + account = self.request.query_params.get('account') + if asset is None or account is None: + return Response({'count': None}) + + queryset = Session.objects.filter(is_finished=True) \ + .filter(asset_id=asset) \ + .filter(protocol='rdp') # 当前只统计 rdp 协议的会话 + if '(' in account and ')' in account: + queryset = queryset.filter(account=account) + else: + queryset = queryset.filter(account__endswith='({})'.format(account)) + count = queryset.count() + return Response({'count': count}) + def get_queryset(self): - queryset = super().get_queryset().prefetch_related('terminal') \ + queryset = super().get_queryset() \ + .prefetch_related('terminal') \ .annotate(terminal_display=F('terminal__name')) return queryset