From df51c82cfd34c308fb1065f311501d71e808ba21 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 14 Mar 2022 17:10:34 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96Migration=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E6=8E=89=E5=8E=9F=E6=9D=A5=E7=9A=84=20content=20type?= =?UTF-8?q?=20(#7835)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ibuler Co-authored-by: Jiangjie.Bai <32935519+BaiJiangJie@users.noreply.github.com> --- apps/locale/zh/LC_MESSAGES/django.mo | 4 +- apps/locale/zh/LC_MESSAGES/django.po | 701 ++++++++---------- apps/rbac/const.py | 4 - .../migrations/0007_auto_20220314_1525.py | 30 + apps/rbac/tree.py | 32 +- .../migrations/0005_auto_20220310_0616.py | 2 +- apps/settings/models.py | 2 +- 7 files changed, 364 insertions(+), 411 deletions(-) create mode 100644 apps/rbac/migrations/0007_auto_20220314_1525.py diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index a0b66d917..2eaac4eff 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:a885732955761c2942989a3e93751709e2be4ec75504bd009406671b93e0bfda -size 107544 +oid sha256:675f93d2cc6b2049fdafc7f6b70edb8f73bbe132de9b91e98f2ec7acb2e89620 +size 104134 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 4ebc1fe65..fb87ca863 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: 2022-03-10 20:12+0800\n" +"POT-Creation-Date: 2022-03-14 15:58+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -68,7 +68,7 @@ msgstr "激活中" #: tickets/models/comment.py:24 tickets/models/ticket.py:154 #: users/models/group.py:16 users/models/user.py:611 #: xpack/plugins/change_auth_plan/models/base.py:44 -#: xpack/plugins/cloud/models.py:35 xpack/plugins/cloud/models.py:113 +#: xpack/plugins/cloud/models.py:35 xpack/plugins/cloud/models.py:116 #: xpack/plugins/gathered_user/models.py:26 msgid "Comment" msgstr "备注" @@ -90,7 +90,7 @@ msgstr "登录复核" #: assets/models/cmd_filter.py:30 assets/models/label.py:15 audits/models.py:37 #: audits/models.py:60 audits/models.py:85 audits/serializers.py:100 #: authentication/models.py:50 orgs/models.py:196 perms/models/base.py:84 -#: rbac/builtin.py:96 rbac/models/rolebinding.py:35 templates/index.html:78 +#: rbac/builtin.py:97 rbac/models/rolebinding.py:35 templates/index.html:78 #: terminal/backends/command/models.py:19 #: terminal/backends/command/serializers.py:12 terminal/models/session.py:42 #: terminal/notifications.py:88 terminal/notifications.py:136 @@ -146,7 +146,7 @@ msgstr "系统用户" #: users/templates/users/user_asset_permission.html:70 #: xpack/plugins/change_auth_plan/models/asset.py:199 #: xpack/plugins/change_auth_plan/serializers/asset.py:180 -#: xpack/plugins/cloud/models.py:220 +#: xpack/plugins/cloud/models.py:223 msgid "Asset" msgstr "资产" @@ -301,7 +301,7 @@ msgstr "系统用户" msgid "Version" msgstr "版本" -#: applications/models/account.py:23 rbac/ztree/tree_nodes.py:147 +#: applications/models/account.py:23 msgid "Application account" msgstr "应用账号" @@ -373,7 +373,7 @@ msgstr "类型名称" #: common/mixins/models.py:50 ops/models/adhoc.py:39 ops/models/command.py:30 #: orgs/models.py:14 orgs/models.py:199 perms/models/base.py:92 #: users/models/group.py:18 users/models/user.py:825 -#: xpack/plugins/cloud/models.py:122 +#: xpack/plugins/cloud/models.py:125 msgid "Date created" msgstr "创建日期" @@ -489,15 +489,15 @@ msgstr "Vmware 密码" msgid "Number required" msgstr "需要为数字" -#: assets/api/node.py:62 +#: assets/api/node.py:61 msgid "You can't update the root node name" msgstr "不能修改根节点名称" -#: assets/api/node.py:69 +#: assets/api/node.py:68 msgid "You can't delete the root node ({})" msgstr "不能删除根节点 ({})" -#: assets/api/node.py:72 +#: assets/api/node.py:71 msgid "Deletion failed and the node contains assets" msgstr "删除失败,节点包含资产" @@ -586,7 +586,7 @@ msgstr "主机名原始" #: assets/models/asset.py:215 assets/serializers/account.py:16 #: assets/serializers/asset.py:65 perms/serializers/asset/user_permission.py:41 -#: xpack/plugins/cloud/models.py:104 xpack/plugins/cloud/serializers/task.py:42 +#: xpack/plugins/cloud/models.py:107 xpack/plugins/cloud/serializers/task.py:42 msgid "Protocols" msgstr "协议组" @@ -626,7 +626,7 @@ msgstr "标签管理" #: orgs/models.py:201 perms/models/base.py:91 users/models/user.py:619 #: users/serializers/group.py:33 #: xpack/plugins/change_auth_plan/models/base.py:48 -#: xpack/plugins/cloud/models.py:119 xpack/plugins/gathered_user/models.py:30 +#: xpack/plugins/cloud/models.py:122 xpack/plugins/gathered_user/models.py:30 msgid "Created by" msgstr "创建者" @@ -730,7 +730,7 @@ msgstr "触发模式" #: xpack/plugins/change_auth_plan/models/base.py:201 #: xpack/plugins/change_auth_plan/serializers/app.py:66 #: xpack/plugins/change_auth_plan/serializers/asset.py:179 -#: xpack/plugins/cloud/models.py:176 +#: xpack/plugins/cloud/models.py:179 msgid "Reason" msgstr "原因" @@ -839,8 +839,8 @@ msgid "Default Cluster" msgstr "默认Cluster" #: assets/models/cmd_filter.py:34 perms/models/base.py:86 -#: rbac/ztree/tree_nodes.py:84 users/models/group.py:31 -#: users/models/user.py:580 users/templates/users/_select_user_modal.html:16 +#: users/models/group.py:31 users/models/user.py:580 +#: 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 @@ -849,7 +849,6 @@ msgid "User group" msgstr "用户组" #: assets/models/cmd_filter.py:60 assets/serializers/system_user.py:54 -#: rbac/ztree/tree_nodes.py:123 msgid "Command filter" msgstr "命令过滤器" @@ -889,7 +888,7 @@ msgstr "每行一个命令" msgid "Ignore case" msgstr "忽略大小写" -#: assets/models/cmd_filter.py:103 rbac/ztree/tree_nodes.py:126 +#: assets/models/cmd_filter.py:103 msgid "Command filter rule" msgstr "命令过滤规则" @@ -978,7 +977,7 @@ msgstr "ssh私钥" #: users/templates/users/user_asset_permission.html:41 #: users/templates/users/user_asset_permission.html:73 #: users/templates/users/user_asset_permission.html:158 -#: xpack/plugins/cloud/models.py:93 xpack/plugins/cloud/serializers/task.py:69 +#: xpack/plugins/cloud/models.py:96 xpack/plugins/cloud/serializers/task.py:69 msgid "Node" msgstr "节点" @@ -1380,8 +1379,7 @@ msgstr "日志审计" #: audits/models.py:27 audits/models.py:57 #: authentication/templates/authentication/_access_key_modal.html:65 -#: rbac/tree.py:238 rbac/ztree/tree.py:161 -#: users/templates/users/user_asset_permission.html:128 +#: rbac/tree.py:273 users/templates/users/user_asset_permission.html:128 #: users/templates/users/user_database_app_permission.html:111 msgid "Delete" msgstr "删除" @@ -1435,12 +1433,12 @@ msgstr "文件管理" #: audits/models.py:55 #: authentication/templates/authentication/_access_key_modal.html:22 -#: rbac/tree.py:235 rbac/ztree/tree.py:158 +#: rbac/tree.py:270 msgid "Create" msgstr "创建" -#: audits/models.py:56 rbac/tree.py:237 rbac/ztree/tree.py:160 -#: templates/_csv_import_export.html:18 templates/_csv_update_modal.html:6 +#: audits/models.py:56 rbac/tree.py:272 templates/_csv_import_export.html:18 +#: templates/_csv_update_modal.html:6 #: users/templates/users/user_asset_permission.html:127 #: users/templates/users/user_database_app_permission.html:110 msgid "Update" @@ -1509,8 +1507,8 @@ msgid "MFA" msgstr "MFA" #: audits/models.py:126 terminal/models/status.py:33 -#: tickets/models/ticket.py:140 xpack/plugins/cloud/models.py:172 -#: xpack/plugins/cloud/models.py:224 +#: tickets/models/ticket.py:140 xpack/plugins/cloud/models.py:175 +#: xpack/plugins/cloud/models.py:227 msgid "Status" msgstr "状态" @@ -1547,7 +1545,7 @@ msgid "Hosts display" msgstr "主机名称" #: audits/serializers.py:96 ops/models/command.py:27 -#: xpack/plugins/cloud/models.py:170 +#: xpack/plugins/cloud/models.py:173 msgid "Result" msgstr "结果" @@ -1662,7 +1660,6 @@ msgid "{AssetPermission} REMOVE {UserGroup}" msgstr "{AssetPermission} 移除 {UserGroup}" #: audits/signal_handlers.py:131 perms/models/asset_permission.py:29 -#: rbac/ztree/tree_nodes.py:27 rbac/ztree/tree_nodes.py:171 #: users/templates/users/_user_detail_nav_header.html:31 msgid "Asset permission" msgstr "资产授权" @@ -1734,7 +1731,6 @@ msgid "{ApplicationPermission} REMOVE {UserGroup}" msgstr "{ApplicationPermission} 移除 {UserGroup}" #: audits/signal_handlers.py:156 perms/models/application_permission.py:38 -#: rbac/ztree/tree_nodes.py:90 rbac/ztree/tree_nodes.py:174 msgid "Application permission" msgstr "应用授权" @@ -2053,7 +2049,7 @@ msgstr "请修改密码" #: authentication/models.py:33 terminal/serializers/storage.py:30 msgid "Access key" -msgstr "Access key" +msgstr "Api key" #: authentication/models.py:40 msgid "Private Token" @@ -2675,7 +2671,7 @@ msgstr "通知" msgid "Email" msgstr "邮件" -#: notifications/backends/__init__.py:13 rbac/ztree/tree_nodes.py:257 +#: notifications/backends/__init__.py:13 msgid "Site message" msgstr "站内信" @@ -2878,7 +2874,7 @@ msgstr "当前组织 ({}) 不能被删除" msgid "The organization have resource ({}) cannot be deleted" msgstr "组织存在资源 ({}) 不能被删除" -#: orgs/apps.py:7 rbac/tree.py:105 +#: orgs/apps.py:7 rbac/tree.py:112 msgid "App organizations" msgstr "组织管理" @@ -3129,27 +3125,27 @@ msgstr "{} 至少有一个系统角色" msgid "RBAC" msgstr "RBAC" -#: rbac/builtin.py:87 +#: rbac/builtin.py:88 msgid "SystemAdmin" msgstr "系统管理员" -#: rbac/builtin.py:90 +#: rbac/builtin.py:91 msgid "SystemAuditor" msgstr "系统审计员" -#: rbac/builtin.py:93 +#: rbac/builtin.py:94 msgid "SystemComponent" msgstr "系统组件" -#: rbac/builtin.py:99 +#: rbac/builtin.py:100 msgid "OrgAdmin" msgstr "组织管理员" -#: rbac/builtin.py:102 +#: rbac/builtin.py:103 msgid "OrgAuditor" msgstr "组织审计员" -#: rbac/builtin.py:105 +#: rbac/builtin.py:106 msgid "OrgUser" msgstr "组织用户" @@ -3177,10 +3173,6 @@ msgstr "Web终端" msgid "Can view file manager" msgstr "文件管理" -#: rbac/models/menu.py:20 -msgid "Can view dashboard" -msgstr "仪表盘" - #: rbac/models/permission.py:22 msgid "Permission" msgstr "授权" @@ -3197,11 +3189,11 @@ msgstr "授权" msgid "Built-in" msgstr "内置" -#: rbac/models/role.py:127 rbac/ztree/tree_nodes.py:230 +#: rbac/models/role.py:127 msgid "System role" msgstr "系统角色" -#: rbac/models/role.py:135 rbac/ztree/tree_nodes.py:227 +#: rbac/models/role.py:135 msgid "Organization role" msgstr "组织角色" @@ -3243,23 +3235,23 @@ msgstr "角色显示" msgid "Has bound this role" msgstr "已经绑定" -#: rbac/tree.py:17 rbac/tree.py:18 rbac/ztree/tree_nodes.py:6 +#: rbac/tree.py:17 rbac/tree.py:18 msgid "All permissions" msgstr "所有权限" -#: rbac/tree.py:24 rbac/ztree/tree_nodes.py:12 +#: rbac/tree.py:24 msgid "Console view" msgstr "控制台" -#: rbac/tree.py:25 rbac/ztree/tree_nodes.py:21 +#: rbac/tree.py:25 msgid "Workspace view" msgstr "工作台" -#: rbac/tree.py:26 rbac/ztree/tree_nodes.py:24 +#: rbac/tree.py:26 msgid "Audit view" msgstr "审计台" -#: rbac/tree.py:27 rbac/ztree/tree_nodes.py:51 settings/models.py:140 +#: rbac/tree.py:27 settings/models.py:140 msgid "System setting" msgstr "系统设置" @@ -3271,7 +3263,7 @@ msgstr "其它" msgid "Accounts" msgstr "账号管理" -#: rbac/tree.py:40 rbac/ztree/tree_nodes.py:30 +#: rbac/tree.py:40 msgid "Session audits" msgstr "会话审计" @@ -3295,11 +3287,11 @@ msgstr "应用改密" msgid "Asset change auth" msgstr "资产改密" -#: rbac/tree.py:55 rbac/ztree/tree_nodes.py:198 +#: rbac/tree.py:55 msgid "Terminal setting" msgstr "终端设置" -#: rbac/tree.py:56 rbac/ztree/tree_nodes.py:42 +#: rbac/tree.py:56 msgid "My assets" msgstr "我的资产" @@ -3307,313 +3299,23 @@ msgstr "我的资产" msgid "My apps" msgstr "我的应用" -#: rbac/tree.py:106 +#: rbac/tree.py:113 msgid "Ticket comment" msgstr "工单评论" -#: rbac/tree.py:107 +#: rbac/tree.py:114 msgid "Common setting" msgstr "一般设置" -#: rbac/tree.py:236 rbac/ztree/tree.py:159 +#: rbac/tree.py:271 msgid "View" msgstr "查看" -#: rbac/ztree/tree.py:103 rbac/ztree/tree_nodes.py:96 -msgid "Detail" -msgstr "详情" - -#: rbac/ztree/tree_nodes.py:9 -msgid "View menu" -msgstr "视图菜单" - -#: rbac/ztree/tree_nodes.py:15 -msgid "User management" -msgstr "用户管理" - -#: rbac/ztree/tree_nodes.py:18 -msgid "User list" -msgstr "用户列表" - -#: rbac/ztree/tree_nodes.py:33 -msgid "Online/Offline Session record" -msgstr "在线/离线会话记录" - -#: rbac/ztree/tree_nodes.py:36 -msgid "Asset management" -msgstr "资产管理" - -#: rbac/ztree/tree_nodes.py:39 rbac/ztree/tree_nodes.py:117 -msgid "Asset list" -msgstr "资产列表" - -#: rbac/ztree/tree_nodes.py:45 -msgid "My application" -msgstr "我的应用" - -#: rbac/ztree/tree_nodes.py:48 rbac/ztree/tree_nodes.py:254 -msgid "Bulk command" -msgstr "批量命令" - -#: rbac/ztree/tree_nodes.py:54 -msgid "Ticket system" -msgstr "工单系统" - -#: rbac/ztree/tree_nodes.py:57 templates/_header_bar.html:12 -msgid "Help" -msgstr "帮助" - -#: rbac/ztree/tree_nodes.py:60 -msgid "API permission" -msgstr "API权限" - -#: rbac/ztree/tree_nodes.py:63 -msgid "Application management" -msgstr "应用管理" - -#: rbac/ztree/tree_nodes.py:66 -msgid "Account management" -msgstr "账号管理" - -#: rbac/ztree/tree_nodes.py:69 -msgid "Permission management" -msgstr "权限管理" - -#: rbac/ztree/tree_nodes.py:72 -msgid "Access control" -msgstr "访问控制" - -#: rbac/ztree/tree_nodes.py:75 -msgid "Job center" -msgstr "作业中心" - -#: rbac/ztree/tree_nodes.py:78 -msgid "Session audit" -msgstr "会话审计" - -#: rbac/ztree/tree_nodes.py:81 -msgid "Log audit" -msgstr "日志审计" - -#: rbac/ztree/tree_nodes.py:87 -msgid "Role list" -msgstr "角色列表" - -#: rbac/ztree/tree_nodes.py:93 -msgid "User login acl" -msgstr "用户登录规则" - -#: rbac/ztree/tree_nodes.py:99 -msgid "Permission list" -msgstr "权限列表" - -#: rbac/ztree/tree_nodes.py:102 -msgid "Node tree" -msgstr "节点树" - -#: rbac/ztree/tree_nodes.py:105 -msgid "Cloud sync" -msgstr "云同步" - -#: rbac/ztree/tree_nodes.py:108 -msgid "Sync instance task list" -msgstr "同步实例任务列表" - -#: rbac/ztree/tree_nodes.py:111 rbac/ztree/tree_nodes.py:120 -msgid "Account list" -msgstr "账号列表" - -#: rbac/ztree/tree_nodes.py:114 -msgid "Common/Admin User" -msgstr "普通/特权用户" - -#: rbac/ztree/tree_nodes.py:129 -msgid "Platform list" -msgstr "平台列表" - -#: rbac/ztree/tree_nodes.py:132 -msgid "Label management" -msgstr "标签管理" - -#: rbac/ztree/tree_nodes.py:135 -msgid "Remote application" -msgstr "远程应用" - -#: rbac/ztree/tree_nodes.py:138 rbac/ztree/tree_nodes.py:192 -msgid "Database application" -msgstr "数据库应用" - -#: rbac/ztree/tree_nodes.py:141 rbac/ztree/tree_nodes.py:195 -msgid "Kubernetes" -msgstr "" - -#: rbac/ztree/tree_nodes.py:144 -msgid "Asset account" -msgstr "资产账号" - -#: rbac/ztree/tree_nodes.py:150 xpack/plugins/gathered_user/meta.py:11 -msgid "Gathered user" -msgstr "收集用户" - -#: rbac/ztree/tree_nodes.py:153 -msgid "Gathered user list" -msgstr "收集用户列表" - -#: rbac/ztree/tree_nodes.py:156 -msgid "Gathered user task list" -msgstr "收集用户任务列表" - -#: rbac/ztree/tree_nodes.py:159 xpack/plugins/change_auth_plan/meta.py:9 -#: xpack/plugins/change_auth_plan/models/asset.py:123 -msgid "Change auth plan" -msgstr "改密计划" - -#: rbac/ztree/tree_nodes.py:162 -#: xpack/plugins/change_auth_plan/models/asset.py:67 -msgid "Asset change auth plan" -msgstr "资产改密计划" - -#: rbac/ztree/tree_nodes.py:165 xpack/plugins/change_auth_plan/models/app.py:46 -#: xpack/plugins/change_auth_plan/models/app.py:95 -msgid "Application change auth plan" -msgstr "应用改密计划" - -#: rbac/ztree/tree_nodes.py:168 -msgid "Account backup" -msgstr "账号备份" - -#: rbac/ztree/tree_nodes.py:177 -msgid "Asset login" -msgstr "资产登录" - -#: rbac/ztree/tree_nodes.py:180 -msgid "Task list" -msgstr "任务列表" - -#: rbac/ztree/tree_nodes.py:183 terminal/models/command.py:24 -msgid "Command record" -msgstr "命令记录" - -#: rbac/ztree/tree_nodes.py:186 -msgid "File transfer" -msgstr "文件传输" - -#: rbac/ztree/tree_nodes.py:189 -msgid "Remote App" -msgstr "远程应用" - -#: rbac/ztree/tree_nodes.py:201 -msgid "Terminal management" -msgstr "终端管理" - -#: rbac/ztree/tree_nodes.py:204 terminal/models/storage.py:113 -#: terminal/models/terminal.py:108 -msgid "Command storage" -msgstr "命令存储" - -#: rbac/ztree/tree_nodes.py:207 terminal/models/storage.py:173 -#: terminal/models/terminal.py:109 -msgid "Replay storage" -msgstr "录像存储" - -#: rbac/ztree/tree_nodes.py:210 -msgid "Organization management" -msgstr "组织管理" - -#: rbac/ztree/tree_nodes.py:213 xpack/plugins/license/meta.py:11 -#: xpack/plugins/license/models.py:127 -msgid "License" -msgstr "许可证" - -#: rbac/ztree/tree_nodes.py:218 -msgid "View all permission" -msgstr "查看所有权限" - -#: rbac/ztree/tree_nodes.py:221 -msgid "Domain list" -msgstr "网域列表" - -#: rbac/ztree/tree_nodes.py:224 -msgid "Gateway list" -msgstr "网关列表" - -#: rbac/ztree/tree_nodes.py:233 -msgid "Run gather user task" -msgstr "执行收集用户任务" - -#: rbac/ztree/tree_nodes.py:236 -msgid "Run asset change auth plan" -msgstr "执行资产改密计划" - -#: rbac/ztree/tree_nodes.py:239 -msgid "Run application change auth plan" -msgstr "执行应用改密计划" - -#: rbac/ztree/tree_nodes.py:242 -msgid "Run account backup plan" -msgstr "执行账号备份计划" - -#: rbac/ztree/tree_nodes.py:245 -msgid "Run task" -msgstr "运行任务" - -#: rbac/ztree/tree_nodes.py:248 -msgid "View task version" -msgstr "查看任务版本" - -#: rbac/ztree/tree_nodes.py:251 -msgid "View execution history" -msgstr "查看执行历史" - -#: rbac/ztree/tree_nodes.py:260 -msgid "Message subscription" -msgstr "消息订阅" - -#: rbac/ztree/tree_nodes.py:263 -msgid "Component monitor" -msgstr "组件监控" - -#: rbac/ztree/tree_nodes.py:266 -msgid "View my/assigned ticket" -msgstr "查看我的/待审批工单" - -#: rbac/ztree/tree_nodes.py:269 -msgid "Create asset/application ticket" -msgstr "创建资产/应用申请工单" - -#: rbac/ztree/tree_nodes.py:272 -msgid "Change/close ticket" -msgstr "更新/关闭工单" - -#: rbac/ztree/tree_nodes.py:275 -msgid "View some of the assets searched" -msgstr "查看搜索的部分资产" - -#: rbac/ztree/tree_nodes.py:282 -msgid "Overview" -msgstr "概览" - -#: rbac/ztree/tree_nodes.py:287 rbac/ztree/tree_nodes.py:296 -msgid "View permission user" -msgstr "查看授权用户" - -#: rbac/ztree/tree_nodes.py:290 rbac/ztree/tree_nodes.py:299 -msgid "Add user to role" -msgstr "添加用户到角色" - -#: rbac/ztree/tree_nodes.py:293 rbac/ztree/tree_nodes.py:302 -msgid "Remove user from role" -msgstr "从角色移除用户" - -#: rbac/ztree/tree_nodes.py:305 -msgid "Run sync instance task" -msgstr "执行同步实例任务" - #: settings/api/alibaba_sms.py:31 settings/api/tencent_sms.py:35 msgid "test_phone is required" msgstr "测试手机号 该字段是必填项。" -#: settings/api/alibaba_sms.py:52 settings/api/dingtalk.py:28 +#: settings/api/alibaba_sms.py:52 settings/api/dingtalk.py:31 #: settings/api/feishu.py:36 settings/api/tencent_sms.py:57 #: settings/api/wecom.py:37 msgid "Test success" @@ -3648,46 +3350,42 @@ msgid "Settings" msgstr "系统设置" #: settings/models.py:142 -msgid "Can change basic setting" -msgstr "基本设置" - -#: settings/models.py:143 msgid "Can change email setting" msgstr "邮件设置" -#: settings/models.py:144 +#: settings/models.py:143 msgid "Can change auth setting" msgstr "认证设置" -#: settings/models.py:145 -msgid "Can sys msg sub setting" +#: settings/models.py:144 +msgid "Can change system msg sub setting" msgstr "消息订阅设置" -#: settings/models.py:146 +#: settings/models.py:145 msgid "Can change sms setting" msgstr "短信设置" -#: settings/models.py:147 +#: settings/models.py:146 msgid "Can change security setting" msgstr "安全设置" -#: settings/models.py:148 +#: settings/models.py:147 msgid "Can change clean setting" msgstr "定期清理" -#: settings/models.py:149 +#: settings/models.py:148 msgid "Can change interface setting" msgstr "界面设置" -#: settings/models.py:150 +#: settings/models.py:149 msgid "Can change license setting" msgstr "许可证设置" -#: settings/models.py:151 +#: settings/models.py:150 msgid "Can change terminal setting" msgstr "终端设置" -#: settings/models.py:152 +#: settings/models.py:151 msgid "Can change other setting" msgstr "其它设置" @@ -4028,14 +3726,10 @@ msgid "The name of global organization to display" msgstr "全局组织的显示名称,默认为 全局组织" #: settings/serializers/basic.py:44 -msgid "Enable tickets" -msgstr "启用工单" - -#: settings/serializers/basic.py:45 msgid "Enable announcement" msgstr "启用公告" -#: settings/serializers/basic.py:46 +#: settings/serializers/basic.py:45 msgid "Announcement" msgstr "公告" @@ -4648,6 +4342,10 @@ msgstr "下载更新的模板或使用导出的csv格式" msgid "Download the update template" msgstr "下载更新模版" +#: templates/_header_bar.html:12 +msgid "Help" +msgstr "帮助" + #: templates/_header_bar.html:19 msgid "Docs" msgstr "文档" @@ -5099,6 +4797,10 @@ msgstr "不支持批量创建" msgid "Storage is invalid" msgstr "存储无效" +#: terminal/models/command.py:24 +msgid "Command record" +msgstr "命令记录" + #: terminal/models/replay.py:12 msgid "Session replay" msgstr "会话录像" @@ -5228,6 +4930,14 @@ msgstr "运行时间" msgid "Default storage" msgstr "默认存储" +#: terminal/models/storage.py:113 terminal/models/terminal.py:108 +msgid "Command storage" +msgstr "命令存储" + +#: terminal/models/storage.py:173 terminal/models/terminal.py:109 +msgid "Replay storage" +msgstr "录像存储" + #: terminal/models/task.py:17 msgid "Args" msgstr "参数" @@ -5318,7 +5028,7 @@ msgstr "密钥" msgid "Endpoint" msgstr "端点" -#: terminal/serializers/storage.py:66 xpack/plugins/cloud/models.py:217 +#: terminal/serializers/storage.py:66 xpack/plugins/cloud/models.py:220 msgid "Region" msgstr "地域" @@ -6464,6 +6174,16 @@ msgstr "" msgid "The parameter 'action' must be [{}]" msgstr "参数 'action' 必须是 [{}]" +#: xpack/plugins/change_auth_plan/meta.py:9 +#: xpack/plugins/change_auth_plan/models/asset.py:123 +msgid "Change auth plan" +msgstr "改密计划" + +#: xpack/plugins/change_auth_plan/models/app.py:46 +#: xpack/plugins/change_auth_plan/models/app.py:95 +msgid "Application change auth plan" +msgstr "应用改密计划" + #: xpack/plugins/change_auth_plan/models/app.py:99 #: xpack/plugins/change_auth_plan/models/app.py:151 msgid "Application change auth plan execution" @@ -6500,6 +6220,10 @@ msgstr "替换 (由 JumpServer 生成的密钥)" msgid "SSH Key strategy" msgstr "SSH 密钥策略" +#: xpack/plugins/change_auth_plan/models/asset.py:67 +msgid "Asset change auth plan" +msgstr "资产改密计划" + #: xpack/plugins/change_auth_plan/models/asset.py:134 msgid "Asset change auth plan execution" msgstr "资产改密计划执行" @@ -6716,64 +6440,71 @@ msgstr "云管中心" msgid "Provider" msgstr "云服务商" -#: xpack/plugins/cloud/models.py:39 xpack/plugins/cloud/models.py:82 -#: xpack/plugins/cloud/serializers/task.py:66 +#: xpack/plugins/cloud/models.py:39 +msgid "Cloud account" +msgstr "云账号" + +#: xpack/plugins/cloud/models.py:41 +msgid "Test cloud account" +msgstr "测试云账号" + +#: xpack/plugins/cloud/models.py:85 xpack/plugins/cloud/serializers/task.py:66 msgid "Account" msgstr "账号" -#: xpack/plugins/cloud/models.py:85 xpack/plugins/cloud/serializers/task.py:37 +#: xpack/plugins/cloud/models.py:88 xpack/plugins/cloud/serializers/task.py:37 msgid "Regions" msgstr "地域" -#: xpack/plugins/cloud/models.py:88 +#: xpack/plugins/cloud/models.py:91 msgid "Hostname strategy" msgstr "主机名策略" -#: xpack/plugins/cloud/models.py:97 xpack/plugins/cloud/serializers/task.py:67 +#: xpack/plugins/cloud/models.py:100 xpack/plugins/cloud/serializers/task.py:67 msgid "Unix admin user" msgstr "Unix 管理员" -#: xpack/plugins/cloud/models.py:101 xpack/plugins/cloud/serializers/task.py:68 +#: xpack/plugins/cloud/models.py:104 xpack/plugins/cloud/serializers/task.py:68 msgid "Windows admin user" msgstr "Windows 管理员" -#: xpack/plugins/cloud/models.py:107 xpack/plugins/cloud/serializers/task.py:45 +#: xpack/plugins/cloud/models.py:110 xpack/plugins/cloud/serializers/task.py:45 msgid "IP network segment group" msgstr "IP网段组" -#: xpack/plugins/cloud/models.py:110 xpack/plugins/cloud/serializers/task.py:71 +#: xpack/plugins/cloud/models.py:113 xpack/plugins/cloud/serializers/task.py:71 msgid "Always update" msgstr "总是更新" -#: xpack/plugins/cloud/models.py:116 +#: xpack/plugins/cloud/models.py:119 msgid "Date last sync" msgstr "最后同步日期" -#: xpack/plugins/cloud/models.py:127 xpack/plugins/cloud/models.py:168 +#: xpack/plugins/cloud/models.py:130 xpack/plugins/cloud/models.py:171 msgid "Sync instance task" msgstr "同步实例任务" -#: xpack/plugins/cloud/models.py:179 xpack/plugins/cloud/models.py:227 +#: xpack/plugins/cloud/models.py:182 xpack/plugins/cloud/models.py:230 msgid "Date sync" msgstr "同步日期" -#: xpack/plugins/cloud/models.py:183 +#: xpack/plugins/cloud/models.py:186 msgid "Sync instance task execution" msgstr "同步实例任务执行" -#: xpack/plugins/cloud/models.py:207 +#: xpack/plugins/cloud/models.py:210 msgid "Sync task" msgstr "同步任务" -#: xpack/plugins/cloud/models.py:211 +#: xpack/plugins/cloud/models.py:214 msgid "Sync instance task history" msgstr "同步实例任务历史" -#: xpack/plugins/cloud/models.py:214 +#: xpack/plugins/cloud/models.py:217 msgid "Instance" msgstr "实例" -#: xpack/plugins/cloud/models.py:231 +#: xpack/plugins/cloud/models.py:234 msgid "Sync instance detail" msgstr "同步实例详情" @@ -7012,6 +6743,10 @@ msgstr "定时执行" msgid "Account unavailable" msgstr "账号无效" +#: xpack/plugins/gathered_user/meta.py:11 +msgid "Gathered user" +msgstr "收集用户" + #: xpack/plugins/gathered_user/models.py:39 msgid "Gather user task" msgstr "收集用户任务" @@ -7028,11 +6763,11 @@ msgstr "资产为空,请更改节点" msgid "Executed times" msgstr "执行次数" -#: xpack/plugins/interface/api.py:46 +#: xpack/plugins/interface/api.py:50 msgid "It is already in the default setting state!" msgstr "当前已经是初始化状态!" -#: xpack/plugins/interface/api.py:49 +#: xpack/plugins/interface/api.py:53 msgid "Restore default successfully." msgstr "恢复默认成功!" @@ -7072,6 +6807,10 @@ msgstr "许可证导入成功" msgid "License is invalid" msgstr "无效的许可证" +#: xpack/plugins/license/meta.py:11 xpack/plugins/license/models.py:127 +msgid "License" +msgstr "许可证" + #: xpack/plugins/license/models.py:71 msgid "Standard edition" msgstr "标准版" @@ -7088,6 +6827,198 @@ msgstr "旗舰版" msgid "Community edition" msgstr "社区版" +#~ msgid "Can view dashboard" +#~ msgstr "仪表盘" + +#~ msgid "Detail" +#~ msgstr "详情" + +#~ msgid "View menu" +#~ msgstr "视图菜单" + +#~ msgid "User management" +#~ msgstr "用户管理" + +#~ msgid "User list" +#~ msgstr "用户列表" + +#~ msgid "Online/Offline Session record" +#~ msgstr "在线/离线会话记录" + +#~ msgid "Asset management" +#~ msgstr "资产管理" + +#~ msgid "Asset list" +#~ msgstr "资产列表" + +#~ msgid "My application" +#~ msgstr "我的应用" + +#~ msgid "Bulk command" +#~ msgstr "批量命令" + +#~ msgid "Ticket system" +#~ msgstr "工单系统" + +#~ msgid "API permission" +#~ msgstr "API权限" + +#~ msgid "Application management" +#~ msgstr "应用管理" + +#~ msgid "Account management" +#~ msgstr "账号管理" + +#~ msgid "Permission management" +#~ msgstr "权限管理" + +#~ msgid "Access control" +#~ msgstr "访问控制" + +#~ msgid "Job center" +#~ msgstr "作业中心" + +#~ msgid "Session audit" +#~ msgstr "会话审计" + +#~ msgid "Log audit" +#~ msgstr "日志审计" + +#~ msgid "Role list" +#~ msgstr "角色列表" + +#~ msgid "User login acl" +#~ msgstr "用户登录规则" + +#~ msgid "Permission list" +#~ msgstr "权限列表" + +#~ msgid "Node tree" +#~ msgstr "节点树" + +#~ msgid "Cloud sync" +#~ msgstr "云同步" + +#~ msgid "Sync instance task list" +#~ msgstr "同步实例任务列表" + +#~ msgid "Account list" +#~ msgstr "账号列表" + +#~ msgid "Common/Admin User" +#~ msgstr "普通/特权用户" + +#~ msgid "Platform list" +#~ msgstr "平台列表" + +#~ msgid "Label management" +#~ msgstr "标签管理" + +#~ msgid "Remote application" +#~ msgstr "远程应用" + +#~ msgid "Database application" +#~ msgstr "数据库应用" + +#~ msgid "Asset account" +#~ msgstr "资产账号" + +#~ msgid "Gathered user list" +#~ msgstr "收集用户列表" + +#~ msgid "Gathered user task list" +#~ msgstr "收集用户任务列表" + +#~ msgid "Account backup" +#~ msgstr "账号备份" + +#~ msgid "Asset login" +#~ msgstr "资产登录" + +#~ msgid "Task list" +#~ msgstr "任务列表" + +#~ msgid "File transfer" +#~ msgstr "文件传输" + +#~ msgid "Remote App" +#~ msgstr "远程应用" + +#~ msgid "Terminal management" +#~ msgstr "终端管理" + +#~ msgid "Organization management" +#~ msgstr "组织管理" + +#~ msgid "View all permission" +#~ msgstr "查看所有权限" + +#~ msgid "Domain list" +#~ msgstr "网域列表" + +#~ msgid "Gateway list" +#~ msgstr "网关列表" + +#~ msgid "Run gather user task" +#~ msgstr "执行收集用户任务" + +#~ msgid "Run asset change auth plan" +#~ msgstr "执行资产改密计划" + +#~ msgid "Run application change auth plan" +#~ msgstr "执行应用改密计划" + +#~ msgid "Run account backup plan" +#~ msgstr "执行账号备份计划" + +#~ msgid "Run task" +#~ msgstr "运行任务" + +#~ msgid "View task version" +#~ msgstr "查看任务版本" + +#~ msgid "View execution history" +#~ msgstr "查看执行历史" + +#~ msgid "Message subscription" +#~ msgstr "消息订阅" + +#~ msgid "Component monitor" +#~ msgstr "组件监控" + +#~ msgid "View my/assigned ticket" +#~ msgstr "查看我的/待审批工单" + +#~ msgid "Create asset/application ticket" +#~ msgstr "创建资产/应用申请工单" + +#~ msgid "Change/close ticket" +#~ msgstr "更新/关闭工单" + +#~ msgid "View some of the assets searched" +#~ msgstr "查看搜索的部分资产" + +#~ msgid "Overview" +#~ msgstr "概览" + +#~ msgid "View permission user" +#~ msgstr "查看授权用户" + +#~ msgid "Add user to role" +#~ msgstr "添加用户到角色" + +#~ msgid "Remove user from role" +#~ msgstr "从角色移除用户" + +#~ msgid "Run sync instance task" +#~ msgstr "执行同步实例任务" + +#~ msgid "Can change basic setting" +#~ msgstr "基本设置" + +#~ msgid "Enable tickets" +#~ msgstr "启用工单" + #~ msgid "Permed remote application" #~ msgstr "授权的远程应用" @@ -7112,11 +7043,5 @@ msgstr "社区版" #~ msgid "Can change terminal basic setting" #~ msgstr "基本设置" -#~ msgid "Cloud account" -#~ msgstr "云账号" - -#~ msgid "Test cloud account" -#~ msgstr "测试云账号" - #~ msgid "Can view resource statistics" #~ msgstr "可以查看资源统计" diff --git a/apps/rbac/const.py b/apps/rbac/const.py index 6679490c9..c8a75fb42 100644 --- a/apps/rbac/const.py +++ b/apps/rbac/const.py @@ -11,7 +11,6 @@ exclude_permissions = ( # ('App', 'Model', 'Action', 'Resource') Model 和 Resource 可能不同 # users.add_user ('auth', '*', '*', '*'), - ('authentication', 'loginconfirmsetting', '*', '*'), ('captcha', '*', '*', '*'), ('contenttypes', '*', '*', '*'), ('django_cas_ng', '*', '*', '*'), @@ -40,9 +39,6 @@ exclude_permissions = ( ('assets', 'gathereduser', 'add,delete,change', 'gathereduser'), ('assets', 'accountbackupplanexecution', 'delete,change', 'accountbackupplanexecution'), ('assets', 'authbook', 'add', 'authbook'), - ('perms', 'databaseapppermission', '*', '*'), - ('perms', 'k8sapppermission', '*', '*'), - ('perms', 'remoteapppermission', '*', '*'), ('perms', 'userassetgrantedtreenoderelation', '*', '*'), ('perms', 'usergrantedmappingnode', '*', '*'), ('perms', 'permnode', '*', '*'), diff --git a/apps/rbac/migrations/0007_auto_20220314_1525.py b/apps/rbac/migrations/0007_auto_20220314_1525.py new file mode 100644 index 000000000..f861dc964 --- /dev/null +++ b/apps/rbac/migrations/0007_auto_20220314_1525.py @@ -0,0 +1,30 @@ +# Generated by Django 3.1.14 on 2022-03-14 07:25 + +from django.db import migrations + + +def migrate_old_permissions(apps, *args): + ContentType = apps.get_model('rbac', 'ContentType') + content_type_delete_required = [ + ('common', 'permission'), + ('applications', 'databaseapp'), + ('applications', 'k8sapp'), + ('applications', 'remoteapp'), + ('perms', 'databaseapppermission'), + ('perms', 'k8sapppermission'), + ('perms', 'remoteapppermission'), + ('authentication', 'loginconfirmsetting'), + ] + for app, model in content_type_delete_required: + ContentType.objects.filter(app_label=app, model=model).delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ('rbac', '0006_auto_20220310_0616'), + ] + + operations = [ + migrations.RunPython(migrate_old_permissions) + ] diff --git a/apps/rbac/tree.py b/apps/rbac/tree.py index 1e6c69f66..86f744cc7 100644 --- a/apps/rbac/tree.py +++ b/apps/rbac/tree.py @@ -123,28 +123,30 @@ xpack_nodes = [ def _sort_action(node): - value = 0 + if node.isParent: + return ['zz', 0] - if 'view' in node.title: - value += 2 - elif 'add' in node.title: - value += 4 - elif 'change' in node.title: - value += 6 - elif 'delete' in node.title: - value += 8 - else: - value += 10 - return value + action_resource = node.title.split('.')[-1] + action, resource = action_resource.split('_', 2) + action_value_mapper = { + 'view': 2, + 'add': 4, + 'change': 6, + 'delete': 8 + } + v = action_value_mapper.get(action, 10) + return [resource, v] def sort_nodes(node): - value = 0 + value = [] if node.isParent: - value += 50 + value.append(50) else: - value += _sort_action(node) + value.append(0) + + value.extend(_sort_action(node)) return value diff --git a/apps/settings/migrations/0005_auto_20220310_0616.py b/apps/settings/migrations/0005_auto_20220310_0616.py index 5e7d2c747..6bfd753b3 100644 --- a/apps/settings/migrations/0005_auto_20220310_0616.py +++ b/apps/settings/migrations/0005_auto_20220310_0616.py @@ -12,6 +12,6 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( name='setting', - options={'permissions': [('change_email', 'Can change email setting'), ('change_auth', 'Can change auth setting'), ('change_systemmsgsubscription', 'Can sys msg sub setting'), ('change_sms', 'Can change sms setting'), ('change_security', 'Can change security setting'), ('change_clean', 'Can change clean setting'), ('change_interface', 'Can change interface setting'), ('change_license', 'Can change license setting'), ('change_terminal', 'Can change terminal setting'), ('change_other', 'Can change other setting')], 'verbose_name': 'System setting'}, + options={'permissions': [('change_email', 'Can change email setting'), ('change_auth', 'Can change auth setting'), ('change_systemmsgsubscription', 'Can change system msg sub setting'), ('change_sms', 'Can change sms setting'), ('change_security', 'Can change security setting'), ('change_clean', 'Can change clean setting'), ('change_interface', 'Can change interface setting'), ('change_license', 'Can change license setting'), ('change_terminal', 'Can change terminal setting'), ('change_other', 'Can change other setting')], 'verbose_name': 'System setting'}, ), ] diff --git a/apps/settings/models.py b/apps/settings/models.py index 9fb07a18f..4546f9624 100644 --- a/apps/settings/models.py +++ b/apps/settings/models.py @@ -141,7 +141,7 @@ class Setting(models.Model): permissions = [ ('change_email', _('Can change email setting')), ('change_auth', _('Can change auth setting')), - ('change_systemmsgsubscription', _('Can sys msg sub setting')), + ('change_systemmsgsubscription', _('Can change system msg sub setting')), ('change_sms', _('Can change sms setting')), ('change_security', _('Can change security setting')), ('change_clean', _('Can change clean setting')),