feat: 终端会话分享增加消息通知功能

pull/11111/head
fangfang.dong 1 year ago committed by Bryan
parent 99adb6ab7a
commit 2741d7cbdc

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-25 15:37+0800\n"
"POT-Creation-Date: 2023-07-26 19:15+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"
@ -202,6 +202,7 @@ msgstr "作成のみ"
#: terminal/backends/command/models.py:17 terminal/models/session/session.py:31
#: terminal/notifications.py:155 terminal/serializers/command.py:17
#: 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
msgid "Asset"
msgstr "資産"
@ -236,6 +237,7 @@ msgstr "ソース ID"
#: perms/models/asset_permission.py:70 perms/serializers/permission.py:39
#: 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
msgid "Account"
msgstr "アカウント"
@ -314,7 +316,7 @@ msgid "Trigger mode"
msgstr "トリガーモード"
#: accounts/models/automations/backup_account.py:97 audits/models.py:194
#: terminal/models/session/sharing.py:111 xpack/plugins/cloud/models.py:168
#: terminal/models/session/sharing.py:119 xpack/plugins/cloud/models.py:168
msgid "Reason"
msgstr "理由"
@ -655,10 +657,11 @@ msgstr "ID"
#: perms/api/user_permission/mixin.py:55 perms/models/asset_permission.py:58
#: perms/serializers/permission.py:30 rbac/builtin.py:123
#: rbac/models/rolebinding.py:49 terminal/backends/command/models.py:16
#: terminal/models/session/session.py:29 terminal/models/session/sharing.py:32
#: terminal/models/session/session.py:29 terminal/models/session/sharing.py:35
#: terminal/notifications.py:156 terminal/notifications.py:205
#: terminal/serializers/command.py:16
#: terminal/templates/terminal/_msg_command_warning.html:6
#: terminal/templates/terminal/_msg_session_sharing.html:6
#: tickets/models/comment.py:21 users/const.py:14 users/models/user.py:947
#: users/models/user.py:983 users/serializers/group.py:18
msgid "User"
@ -696,7 +699,7 @@ msgid "Key password"
msgstr "キーパスワード"
#: accounts/serializers/account/base.py:80
#: assets/serializers/asset/common.py:309
#: assets/serializers/asset/common.py:311
msgid "Spec info"
msgstr "特別情報"
@ -745,7 +748,7 @@ msgstr "自動タスク実行履歴"
#: 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:56 ops/serializers/celery.py:40
#: terminal/const.py:76 terminal/models/session/sharing.py:107
#: terminal/const.py:76 terminal/models/session/sharing.py:115
#: tickets/views/approve.py:115
msgid "Success"
msgstr "成功"
@ -829,7 +832,7 @@ msgstr "レビュー担当者"
#: acls/models/base.py:43 authentication/models/access_key.py:17
#: authentication/models/connection_token.py:53
#: authentication/templates/authentication/_access_key_modal.html:32
#: perms/models/asset_permission.py:76 terminal/models/session/sharing.py:27
#: perms/models/asset_permission.py:76 terminal/models/session/sharing.py:30
#: tickets/const.py:37
msgid "Active"
msgstr "アクティブ"
@ -839,7 +842,7 @@ msgid "Users"
msgstr "ユーザー"
#: acls/models/base.py:98 assets/models/automations/base.py:17
#: assets/models/cmd_filter.py:38 assets/serializers/asset/common.py:308
#: assets/models/cmd_filter.py:38 assets/serializers/asset/common.py:310
#: rbac/tree.py:35
msgid "Accounts"
msgstr "アカウント"
@ -1152,10 +1155,6 @@ msgstr ""
msgid "Other"
msgstr "その他"
#: assets/const/protocol.py:43
msgid "SFTP enabled"
msgstr "SFTP が有効"
#: assets/const/protocol.py:48
msgid "SFTP home"
msgstr "SFTP ルート パス"
@ -1368,7 +1367,7 @@ msgstr "ドメイン"
msgid "Labels"
msgstr "ラベル"
#: assets/models/asset/common.py:158 assets/serializers/asset/common.py:310
#: assets/models/asset/common.py:158 assets/serializers/asset/common.py:312
#: assets/serializers/asset/host.py:11
msgid "Gathered info"
msgstr "資産ハードウェア情報の収集"
@ -1702,19 +1701,19 @@ msgid "Node path"
msgstr "ノードパスです"
#: assets/serializers/asset/common.py:145
#: assets/serializers/asset/common.py:311
#: assets/serializers/asset/common.py:313
msgid "Auto info"
msgstr "自動情報"
#: assets/serializers/asset/common.py:234
#: assets/serializers/asset/common.py:236
msgid "Platform not exist"
msgstr "プラットフォームが存在しません"
#: assets/serializers/asset/common.py:270
#: assets/serializers/asset/common.py:272
msgid "port out of range (0-65535)"
msgstr "ポート番号が範囲外です (0-65535)"
#: assets/serializers/asset/common.py:277
#: assets/serializers/asset/common.py:279
msgid "Protocol is required: {}"
msgstr "プロトコルが必要です: {}"
@ -1998,6 +1997,7 @@ msgstr "マップディレクトリ"
#: audits/const.py:23 rbac/tree.py:229
#: terminal/templates/terminal/_msg_command_warning.html:18
#: terminal/templates/terminal/_msg_session_sharing.html:10
msgid "View"
msgstr "表示"
@ -2061,7 +2061,7 @@ msgid "Job audit log"
msgstr "ジョブ監査ログ"
#: audits/models.py:51 audits/models.py:95 audits/models.py:166
#: terminal/models/session/session.py:38 terminal/models/session/sharing.py:99
#: terminal/models/session/session.py:38 terminal/models/session/sharing.py:107
msgid "Remote addr"
msgstr "リモートaddr"
@ -2078,8 +2078,8 @@ msgid "File"
msgstr "書類"
#: audits/models.py:62 terminal/backends/command/models.py:21
#: terminal/models/session/replay.py:9 terminal/models/session/sharing.py:18
#: terminal/models/session/sharing.py:81
#: terminal/models/session/replay.py:9 terminal/models/session/sharing.py:21
#: terminal/models/session/sharing.py:89
#: terminal/templates/terminal/_msg_command_alert.html:10
#: terminal/templates/terminal/_msg_command_warning.html:17
#: tickets/models/ticket/command_confirm.py:15
@ -2940,7 +2940,8 @@ msgid "request new one"
msgstr "新しいものを要求する"
#: authentication/templates/authentication/_msg_reset_password_code.html:12
#: terminal/models/session/sharing.py:25 terminal/models/session/sharing.py:83
#: terminal/models/session/sharing.py:28 terminal/models/session/sharing.py:91
#: terminal/templates/terminal/_msg_session_sharing.html:12
#: users/forms/profile.py:107 users/templates/users/forgot_password.html:66
msgid "Verify code"
msgstr "コードの確認"
@ -3688,7 +3689,7 @@ msgstr "アルグ"
#: ops/models/adhoc.py:25 ops/models/base.py:16 ops/models/base.py:53
#: ops/models/job.py:106 ops/models/job.py:192 ops/models/playbook.py:25
#: terminal/models/session/sharing.py:23
#: terminal/models/session/sharing.py:26
msgid "Creator"
msgstr "作成者"
@ -3729,7 +3730,7 @@ msgstr "タスクモニターを表示できます"
msgid "Kwargs"
msgstr "クワーグ"
#: ops/models/celery.py:61 terminal/models/session/sharing.py:114
#: ops/models/celery.py:61 terminal/models/session/sharing.py:122
#: tickets/const.py:25
msgid "Finished"
msgstr "終了"
@ -3925,6 +3926,7 @@ msgstr "アプリ組織"
#: rbac/const.py:7 rbac/models/rolebinding.py:56
#: rbac/serializers/rolebinding.py:40 settings/serializers/auth/ldap.py:63
#: terminal/templates/terminal/_msg_command_warning.html:21
#: terminal/templates/terminal/_msg_session_sharing.html:14
#: tickets/models/ticket/general.py:302 tickets/serializers/ticket/ticket.py:60
msgid "Organization"
msgstr "組織"
@ -5742,7 +5744,7 @@ msgstr "出力"
msgid "Risk level"
msgstr "リスクレベル"
#: terminal/connect_methods.py:34
#: terminal/connect_methods.py:35
msgid "DB Client"
msgstr "データベース クライアント"
@ -5998,7 +6000,7 @@ msgstr "セッション再生をダウンロードできます"
msgid "Account id"
msgstr "アカウント ID"
#: terminal/models/session/session.py:36 terminal/models/session/sharing.py:104
#: terminal/models/session/session.py:36 terminal/models/session/sharing.py:112
msgid "Login from"
msgstr "ログイン元"
@ -6030,56 +6032,61 @@ msgstr "セッションを終了できます"
msgid "Can validate session action perm"
msgstr "セッションアクションのパーマを検証できます"
#: terminal/models/session/sharing.py:30
#: terminal/models/session/sharing.py:33
msgid "Expired time (min)"
msgstr "期限切れ時間 (分)"
#: terminal/models/session/sharing.py:35 terminal/serializers/sharing.py:20
#: terminal/models/session/sharing.py:37 terminal/serializers/sharing.py:20
#: terminal/serializers/sharing.py:52
msgid "Action permission"
msgstr "アクションパーミッション"
#: terminal/models/session/sharing.py:40 terminal/models/session/sharing.py:86
#: terminal/models/session/sharing.py:39
msgid "Origin"
msgstr ""
#: terminal/models/session/sharing.py:43 terminal/models/session/sharing.py:94
#: terminal/notifications.py:261
msgid "Session sharing"
msgstr "セッション共有"
#: terminal/models/session/sharing.py:42
#: terminal/models/session/sharing.py:45
msgid "Can add super session sharing"
msgstr "スーパーセッション共有を追加できます"
#: terminal/models/session/sharing.py:69
#: terminal/models/session/sharing.py:77
msgid "Link not active"
msgstr "リンクがアクティブでない"
#: terminal/models/session/sharing.py:71
#: terminal/models/session/sharing.py:79
msgid "Link expired"
msgstr "リンク期限切れ"
#: terminal/models/session/sharing.py:73
#: terminal/models/session/sharing.py:81
msgid "User not allowed to join"
msgstr "ユーザーはセッションに参加できません"
#: terminal/models/session/sharing.py:90 terminal/serializers/sharing.py:71
#: terminal/models/session/sharing.py:98 terminal/serializers/sharing.py:71
msgid "Joiner"
msgstr "ジョイナー"
#: terminal/models/session/sharing.py:93
#: terminal/models/session/sharing.py:101
msgid "Date joined"
msgstr "参加日"
#: terminal/models/session/sharing.py:96
#: terminal/models/session/sharing.py:104
msgid "Date left"
msgstr "日付が残っています"
#: terminal/models/session/sharing.py:119
#: terminal/models/session/sharing.py:127
msgid "Session join record"
msgstr "セッション参加記録"
#: terminal/models/session/sharing.py:135
#: terminal/models/session/sharing.py:143
msgid "Invalid verification code"
msgstr "検証コードが無効"
#: terminal/models/session/sharing.py:142
#: terminal/models/session/sharing.py:150
msgid "You have already joined this session"
msgstr "すでにこのセッションに参加しています"
@ -6388,6 +6395,10 @@ msgstr "チェックコマンドと録画ストレージの接続性"
msgid "view"
msgstr "表示"
#: terminal/templates/terminal/_msg_session_sharing.html:10
msgid "Session sharing URL"
msgstr "セッション共有 URL"
#: terminal/utils/db_port_mapper.py:85
msgid ""
"No available port is matched. The number of databases may have exceeded the "
@ -7892,6 +7903,9 @@ msgstr "究極のエディション"
msgid "Community edition"
msgstr "コミュニティ版"
#~ msgid "SFTP enabled"
#~ msgstr "SFTP が有効"
#~ msgid "Item"
#~ msgstr "アイテム"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-25 15:37+0800\n"
"POT-Creation-Date: 2023-07-26 19:14+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"
@ -201,6 +201,7 @@ msgstr "仅创建"
#: terminal/backends/command/models.py:17 terminal/models/session/session.py:31
#: terminal/notifications.py:155 terminal/serializers/command.py:17
#: 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
msgid "Asset"
msgstr "资产"
@ -235,6 +236,7 @@ msgstr "来源 ID"
#: perms/models/asset_permission.py:70 perms/serializers/permission.py:39
#: 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
msgid "Account"
msgstr "账号"
@ -313,7 +315,7 @@ msgid "Trigger mode"
msgstr "触发模式"
#: accounts/models/automations/backup_account.py:97 audits/models.py:194
#: terminal/models/session/sharing.py:111 xpack/plugins/cloud/models.py:168
#: terminal/models/session/sharing.py:119 xpack/plugins/cloud/models.py:168
msgid "Reason"
msgstr "原因"
@ -651,10 +653,11 @@ msgstr "ID"
#: perms/api/user_permission/mixin.py:55 perms/models/asset_permission.py:58
#: perms/serializers/permission.py:30 rbac/builtin.py:123
#: rbac/models/rolebinding.py:49 terminal/backends/command/models.py:16
#: terminal/models/session/session.py:29 terminal/models/session/sharing.py:32
#: terminal/models/session/session.py:29 terminal/models/session/sharing.py:35
#: terminal/notifications.py:156 terminal/notifications.py:205
#: terminal/serializers/command.py:16
#: terminal/templates/terminal/_msg_command_warning.html:6
#: terminal/templates/terminal/_msg_session_sharing.html:6
#: tickets/models/comment.py:21 users/const.py:14 users/models/user.py:947
#: users/models/user.py:983 users/serializers/group.py:18
msgid "User"
@ -692,7 +695,7 @@ msgid "Key password"
msgstr "密钥密码"
#: accounts/serializers/account/base.py:80
#: assets/serializers/asset/common.py:309
#: assets/serializers/asset/common.py:311
msgid "Spec info"
msgstr "特殊信息"
@ -741,7 +744,7 @@ msgstr "自动化任务执行历史"
#: 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:56 ops/serializers/celery.py:40
#: terminal/const.py:76 terminal/models/session/sharing.py:107
#: terminal/const.py:76 terminal/models/session/sharing.py:115
#: tickets/views/approve.py:115
msgid "Success"
msgstr "成功"
@ -825,7 +828,7 @@ msgstr "审批人"
#: acls/models/base.py:43 authentication/models/access_key.py:17
#: authentication/models/connection_token.py:53
#: authentication/templates/authentication/_access_key_modal.html:32
#: perms/models/asset_permission.py:76 terminal/models/session/sharing.py:27
#: perms/models/asset_permission.py:76 terminal/models/session/sharing.py:30
#: tickets/const.py:37
msgid "Active"
msgstr "激活中"
@ -835,7 +838,7 @@ msgid "Users"
msgstr "用户管理"
#: acls/models/base.py:98 assets/models/automations/base.py:17
#: assets/models/cmd_filter.py:38 assets/serializers/asset/common.py:308
#: assets/models/cmd_filter.py:38 assets/serializers/asset/common.py:310
#: rbac/tree.py:35
msgid "Accounts"
msgstr "账号管理"
@ -1145,10 +1148,6 @@ msgstr "ChatGPT"
msgid "Other"
msgstr "其它"
#: assets/const/protocol.py:43
msgid "SFTP enabled"
msgstr "SFTP 已启用"
#: assets/const/protocol.py:48
msgid "SFTP home"
msgstr "SFTP 根路径"
@ -1361,7 +1360,7 @@ msgstr "网域"
msgid "Labels"
msgstr "标签管理"
#: assets/models/asset/common.py:158 assets/serializers/asset/common.py:310
#: assets/models/asset/common.py:158 assets/serializers/asset/common.py:312
#: assets/serializers/asset/host.py:11
msgid "Gathered info"
msgstr "收集资产硬件信息"
@ -1693,19 +1692,19 @@ msgid "Node path"
msgstr "节点路径"
#: assets/serializers/asset/common.py:145
#: assets/serializers/asset/common.py:311
#: assets/serializers/asset/common.py:313
msgid "Auto info"
msgstr "自动化信息"
#: assets/serializers/asset/common.py:234
#: assets/serializers/asset/common.py:236
msgid "Platform not exist"
msgstr "平台不存在"
#: assets/serializers/asset/common.py:270
#: assets/serializers/asset/common.py:272
msgid "port out of range (0-65535)"
msgstr "端口超出范围 (0-65535)"
#: assets/serializers/asset/common.py:277
#: assets/serializers/asset/common.py:279
msgid "Protocol is required: {}"
msgstr "协议是必填的: {}"
@ -1982,6 +1981,7 @@ msgstr "映射目录"
#: audits/const.py:23 rbac/tree.py:229
#: terminal/templates/terminal/_msg_command_warning.html:18
#: terminal/templates/terminal/_msg_session_sharing.html:10
msgid "View"
msgstr "查看"
@ -2045,7 +2045,7 @@ msgid "Job audit log"
msgstr "作业审计日志"
#: audits/models.py:51 audits/models.py:95 audits/models.py:166
#: terminal/models/session/session.py:38 terminal/models/session/sharing.py:99
#: terminal/models/session/session.py:38 terminal/models/session/sharing.py:107
msgid "Remote addr"
msgstr "远端地址"
@ -2062,8 +2062,8 @@ msgid "File"
msgstr "文件"
#: audits/models.py:62 terminal/backends/command/models.py:21
#: terminal/models/session/replay.py:9 terminal/models/session/sharing.py:18
#: terminal/models/session/sharing.py:81
#: terminal/models/session/replay.py:9 terminal/models/session/sharing.py:21
#: terminal/models/session/sharing.py:89
#: terminal/templates/terminal/_msg_command_alert.html:10
#: terminal/templates/terminal/_msg_command_warning.html:17
#: tickets/models/ticket/command_confirm.py:15
@ -2904,7 +2904,8 @@ msgid "request new one"
msgstr "重新申请"
#: authentication/templates/authentication/_msg_reset_password_code.html:12
#: terminal/models/session/sharing.py:25 terminal/models/session/sharing.py:83
#: terminal/models/session/sharing.py:28 terminal/models/session/sharing.py:91
#: terminal/templates/terminal/_msg_session_sharing.html:12
#: users/forms/profile.py:107 users/templates/users/forgot_password.html:66
msgid "Verify code"
msgstr "验证码"
@ -3641,7 +3642,7 @@ msgstr "参数"
#: ops/models/adhoc.py:25 ops/models/base.py:16 ops/models/base.py:53
#: ops/models/job.py:106 ops/models/job.py:192 ops/models/playbook.py:25
#: terminal/models/session/sharing.py:23
#: terminal/models/session/sharing.py:26
msgid "Creator"
msgstr "创建者"
@ -3682,7 +3683,7 @@ msgstr "可以查看任务监控"
msgid "Kwargs"
msgstr "其它参数"
#: ops/models/celery.py:61 terminal/models/session/sharing.py:114
#: ops/models/celery.py:61 terminal/models/session/sharing.py:122
#: tickets/const.py:25
msgid "Finished"
msgstr "结束"
@ -3877,6 +3878,7 @@ msgstr "组织管理"
#: rbac/const.py:7 rbac/models/rolebinding.py:56
#: rbac/serializers/rolebinding.py:40 settings/serializers/auth/ldap.py:63
#: terminal/templates/terminal/_msg_command_warning.html:21
#: terminal/templates/terminal/_msg_session_sharing.html:14
#: tickets/models/ticket/general.py:302 tickets/serializers/ticket/ticket.py:60
msgid "Organization"
msgstr "组织"
@ -5655,7 +5657,7 @@ msgstr "输出"
msgid "Risk level"
msgstr "风险等级"
#: terminal/connect_methods.py:34
#: terminal/connect_methods.py:35
msgid "DB Client"
msgstr "数据库客户端"
@ -5911,7 +5913,7 @@ msgstr "可以下载会话录像"
msgid "Account id"
msgstr "账号 ID"
#: terminal/models/session/session.py:36 terminal/models/session/sharing.py:104
#: terminal/models/session/session.py:36 terminal/models/session/sharing.py:112
msgid "Login from"
msgstr "登录来源"
@ -5943,56 +5945,61 @@ msgstr "可以终断会话"
msgid "Can validate session action perm"
msgstr "可以验证会话动作权限"
#: terminal/models/session/sharing.py:30
#: terminal/models/session/sharing.py:33
msgid "Expired time (min)"
msgstr "过期时间 (分)"
#: terminal/models/session/sharing.py:35 terminal/serializers/sharing.py:20
#: terminal/models/session/sharing.py:37 terminal/serializers/sharing.py:20
#: terminal/serializers/sharing.py:52
msgid "Action permission"
msgstr "操作权限"
#: terminal/models/session/sharing.py:40 terminal/models/session/sharing.py:86
#: terminal/models/session/sharing.py:39
msgid "Origin"
msgstr ""
#: terminal/models/session/sharing.py:43 terminal/models/session/sharing.py:94
#: terminal/notifications.py:261
msgid "Session sharing"
msgstr "会话分享"
#: terminal/models/session/sharing.py:42
#: terminal/models/session/sharing.py:45
msgid "Can add super session sharing"
msgstr "可以创建超级会话分享"
#: terminal/models/session/sharing.py:69
#: terminal/models/session/sharing.py:77
msgid "Link not active"
msgstr "链接失效"
#: terminal/models/session/sharing.py:71
#: terminal/models/session/sharing.py:79
msgid "Link expired"
msgstr "链接过期"
#: terminal/models/session/sharing.py:73
#: terminal/models/session/sharing.py:81
msgid "User not allowed to join"
msgstr "该用户无权加入会话"
#: terminal/models/session/sharing.py:90 terminal/serializers/sharing.py:71
#: terminal/models/session/sharing.py:98 terminal/serializers/sharing.py:71
msgid "Joiner"
msgstr "加入者"
#: terminal/models/session/sharing.py:93
#: terminal/models/session/sharing.py:101
msgid "Date joined"
msgstr "加入日期"
#: terminal/models/session/sharing.py:96
#: terminal/models/session/sharing.py:104
msgid "Date left"
msgstr "结束日期"
#: terminal/models/session/sharing.py:119
#: terminal/models/session/sharing.py:127
msgid "Session join record"
msgstr "会话加入记录"
#: terminal/models/session/sharing.py:135
#: terminal/models/session/sharing.py:143
msgid "Invalid verification code"
msgstr "验证码不正确"
#: terminal/models/session/sharing.py:142
#: terminal/models/session/sharing.py:150
msgid "You have already joined this session"
msgstr "您已经加入过此会话"
@ -6296,6 +6303,10 @@ msgstr "检查命令及录像存储可连接性 "
msgid "view"
msgstr "查看"
#: terminal/templates/terminal/_msg_session_sharing.html:10
msgid "Session sharing URL"
msgstr "会话分享 URL"
#: terminal/utils/db_port_mapper.py:85
msgid ""
"No available port is matched. The number of databases may have exceeded the "
@ -7778,6 +7789,9 @@ msgstr "旗舰版"
msgid "Community edition"
msgstr "社区版"
#~ msgid "SFTP enabled"
#~ msgstr "SFTP 已启用"
#~ msgid "Item"
#~ msgstr "项目"

@ -0,0 +1,18 @@
# Generated by Django 4.1.10 on 2023-07-26 10:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('terminal', '0063_auto_20230621_1133'),
]
operations = [
migrations.AddField(
model_name='sessionsharing',
name='origin',
field=models.URLField(blank=True, null=True, verbose_name='Origin'),
),
]

@ -3,8 +3,11 @@ import datetime
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from django.utils.functional import cached_property
from common.utils.random import random_string
from common.db.models import JMSBaseModel
from common.db.fields import JsonListTextField
from orgs.mixins.models import OrgModelMixin
from orgs.utils import tmp_to_root_org
from users.models import User
@ -30,10 +33,10 @@ class SessionSharing(JMSBaseModel, OrgModelMixin):
default=0, verbose_name=_('Expired time (min)'), db_index=True
)
users = models.TextField(blank=True, verbose_name=_("User"))
action_permission = models.CharField(
max_length=16, verbose_name=_('Action permission'), default='writable'
)
origin = models.URLField(blank=True, null=True, verbose_name=_('Origin'))
class Meta:
ordering = ('-date_created',)
@ -45,15 +48,20 @@ class SessionSharing(JMSBaseModel, OrgModelMixin):
def __str__(self):
return 'Creator: {}'.format(self.creator)
@cached_property
def users_display(self):
if not self.users:
return []
with tmp_to_root_org():
user_ids = self.users.split(',')
users = User.objects.filter(id__in=user_ids)
users = self.users_queryset
users = [str(user) for user in users]
return users
@cached_property
def users_queryset(self):
user_ids = self.users.split(',')
return User.objects.filter(id__in=user_ids)
@property
def date_expired(self):
return self.date_created + datetime.timedelta(minutes=self.expired_time)

@ -255,3 +255,27 @@ class StorageConnectivityMessage(SystemMessage):
'subject': subject,
'message': message
}
class SessionSharingMessage(UserMessage):
message_type_label = _('Session sharing')
def __init__(self, user, instance):
super().__init__(user)
self.instance = instance
def get_html_msg(self) -> dict:
instance = self.instance
context = {
'asset': instance.session.asset,
'created_by': instance.created_by,
'account': instance.session.account,
'session_url': '%s/koko/share/%s/' % (instance.origin, instance.id),
'verify_code': instance.verify_code,
'org': instance.org_name,
}
message = render_to_string('terminal/_msg_session_sharing.html', context)
return {
'subject': self.message_type_label + ' ' + self.instance.created_by,
'message': message
}

@ -26,7 +26,7 @@ class SessionSharingSerializer(OrgResourceModelSerializerMixin):
fields_small = fields_mini + [
'verify_code', 'is_active', 'expired_time', 'created_by',
'date_created', 'date_updated', 'users', 'users_display',
'action_permission'
'action_permission', 'origin',
]
fields_fk = ['session', 'creator']
fields = fields_small + fields_fk

@ -1,3 +1,4 @@
from .applet import *
from .db_port import *
from .terminal import *
from .session_sharing import *

@ -0,0 +1,13 @@
from django.db.models.signals import post_save
from django.dispatch import receiver
from terminal.models import SessionSharing
from terminal.notifications import SessionSharingMessage
@receiver(post_save, sender=SessionSharing)
def on_session_sharing_created(sender, instance: SessionSharing, created, **kwargs):
if not created:
return
for user in instance.users_queryset:
SessionSharingMessage(user, instance).publish_async()

@ -0,0 +1,16 @@
{% load i18n %}
<div>
<b>{% trans 'Asset' %}: </b> <span>{{ asset }}</span>
<br/>
<b>{% trans 'User' %}: </b> <span>{{ created_by }}</span>
<br/>
<b>{% trans 'Account' %}: </b> <span>{{ account }}</span>
<br/>
<b>{% trans 'Session sharing URL' %}: </b><a href="{{ session_url }}" target="_blank">{% trans 'View' %}</a>
<br/>
<b>{% trans 'Verify code' %}: </b> <span>{{ verify_code }}</span>
<br/>
<b>{% trans 'Organization' %}: </b> <span>{{ org }}</span>
<br/>
</div>
Loading…
Cancel
Save