diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index 0337649da..8fb1a75b4 100644 Binary files a/apps/locale/zh/LC_MESSAGES/django.mo and b/apps/locale/zh/LC_MESSAGES/django.mo differ diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index c311e0a7f..b819ee494 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: JumpServer 0.3.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-15 17:13+0800\n" +"POT-Creation-Date: 2020-07-21 16:29+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: ibuler \n" "Language-Team: JumpServer team\n" @@ -46,7 +46,7 @@ msgstr "自定义" msgid "Name" msgstr "名称" -#: applications/models/database_app.py:22 assets/models/cmd_filter.py:51 +#: applications/models/database_app.py:22 assets/models/cmd_filter.py:52 #: terminal/models.py:376 terminal/models.py:413 tickets/models/ticket.py:45 #: users/templates/users/user_granted_database_app.html:35 msgid "Type" @@ -72,7 +72,7 @@ msgstr "数据库" #: applications/models/database_app.py:33 applications/models/remote_app.py:45 #: assets/models/asset.py:150 assets/models/asset.py:226 #: assets/models/base.py:237 assets/models/cluster.py:29 -#: assets/models/cmd_filter.py:23 assets/models/cmd_filter.py:56 +#: assets/models/cmd_filter.py:23 assets/models/cmd_filter.py:57 #: assets/models/domain.py:21 assets/models/domain.py:54 #: assets/models/group.py:23 assets/models/label.py:23 ops/models/adhoc.py:37 #: orgs/models.py:18 perms/models/base.py:56 settings/models.py:32 @@ -104,7 +104,7 @@ msgstr "数据库应用" #: assets/serializers/admin_user.py:32 assets/serializers/asset_user.py:47 #: assets/serializers/asset_user.py:84 assets/serializers/system_user.py:44 #: assets/serializers/system_user.py:176 audits/models.py:38 -#: perms/forms/asset_permission.py:89 perms/models/asset_permission.py:80 +#: perms/forms/asset_permission.py:89 perms/models/asset_permission.py:90 #: templates/index.html:82 terminal/backends/command/models.py:19 #: terminal/backends/command/serializers.py:13 terminal/models.py:187 #: users/templates/users/user_asset_permission.html:40 @@ -130,7 +130,7 @@ msgstr "参数" #: applications/models/remote_app.py:39 assets/models/asset.py:224 #: assets/models/base.py:240 assets/models/cluster.py:28 -#: assets/models/cmd_filter.py:26 assets/models/cmd_filter.py:59 +#: assets/models/cmd_filter.py:26 assets/models/cmd_filter.py:60 #: assets/models/group.py:21 common/mixins/models.py:49 orgs/models.py:16 #: perms/models/base.py:54 users/models/user.py:508 #: users/serializers/group.py:35 users/templates/users/user_detail.html:97 @@ -233,7 +233,7 @@ msgid "Domain" msgstr "网域" #: assets/models/asset.py:195 assets/models/user.py:109 -#: perms/models/asset_permission.py:81 +#: perms/models/asset_permission.py:91 #: xpack/plugins/change_auth_plan/models.py:56 #: xpack/plugins/gathered_user/models.py:24 msgid "Nodes" @@ -247,7 +247,7 @@ msgstr "激活" #: assets/models/asset.py:199 assets/models/cluster.py:19 #: assets/models/user.py:65 templates/_nav.html:44 -#: xpack/plugins/cloud/models.py:133 xpack/plugins/cloud/serializers.py:82 +#: xpack/plugins/cloud/models.py:133 xpack/plugins/cloud/serializers.py:83 msgid "Admin user" msgstr "管理用户" @@ -441,48 +441,48 @@ msgstr "北京电信" msgid "BGP full netcom" msgstr "BGP全网通" -#: assets/models/cmd_filter.py:32 assets/models/user.py:119 +#: assets/models/cmd_filter.py:33 assets/models/user.py:119 msgid "Command filter" msgstr "命令过滤器" -#: assets/models/cmd_filter.py:39 +#: assets/models/cmd_filter.py:40 msgid "Regex" msgstr "正则表达式" -#: assets/models/cmd_filter.py:40 ops/models/command.py:23 +#: assets/models/cmd_filter.py:41 ops/models/command.py:23 #: terminal/backends/command/serializers.py:15 terminal/models.py:196 msgid "Command" msgstr "命令" -#: assets/models/cmd_filter.py:45 +#: assets/models/cmd_filter.py:46 msgid "Deny" msgstr "拒绝" -#: assets/models/cmd_filter.py:46 +#: assets/models/cmd_filter.py:47 msgid "Allow" msgstr "允许" -#: assets/models/cmd_filter.py:50 +#: assets/models/cmd_filter.py:51 msgid "Filter" msgstr "过滤器" -#: assets/models/cmd_filter.py:52 assets/models/user.py:113 +#: assets/models/cmd_filter.py:53 assets/models/user.py:113 msgid "Priority" msgstr "优先级" -#: assets/models/cmd_filter.py:52 +#: assets/models/cmd_filter.py:53 msgid "1-100, the higher will be match first" msgstr "优先级可选范围为1-100,1最低优先级,100最高优先级" -#: assets/models/cmd_filter.py:54 xpack/plugins/license/models.py:29 +#: assets/models/cmd_filter.py:55 xpack/plugins/license/models.py:29 msgid "Content" msgstr "内容" -#: assets/models/cmd_filter.py:54 +#: assets/models/cmd_filter.py:55 msgid "One line one command" msgstr "每行一个命令" -#: assets/models/cmd_filter.py:55 audits/models.py:57 +#: assets/models/cmd_filter.py:56 audits/models.py:57 #: authentication/templates/authentication/_access_key_modal.html:34 #: perms/forms/asset_permission.py:20 #: tickets/serializers/request_asset_perm.py:54 @@ -497,7 +497,7 @@ msgstr "每行一个命令" msgid "Action" msgstr "动作" -#: assets/models/cmd_filter.py:63 +#: assets/models/cmd_filter.py:64 msgid "Command filter rule" msgstr "命令过滤规则" @@ -590,7 +590,7 @@ msgstr "键" #: 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:129 xpack/plugins/cloud/serializers.py:83 +#: xpack/plugins/cloud/models.py:129 xpack/plugins/cloud/serializers.py:84 msgid "Node" msgstr "节点" @@ -643,7 +643,7 @@ msgstr "SFTP根路径" #: assets/models/user.py:195 audits/models.py:39 #: perms/forms/asset_permission.py:95 perms/forms/remote_app_permission.py:49 -#: perms/models/asset_permission.py:82 +#: perms/models/asset_permission.py:92 #: perms/models/database_app_permission.py:22 #: perms/models/remote_app_permission.py:16 templates/_nav.html:45 #: terminal/backends/command/models.py:20 @@ -1000,7 +1000,7 @@ msgstr "Agent" #: authentication/templates/authentication/_mfa_confirm_modal.html:14 #: authentication/templates/authentication/login_otp.html:6 #: users/forms/profile.py:52 users/models/user.py:489 -#: users/serializers/user.py:216 users/templates/users/user_detail.html:77 +#: users/serializers/user.py:220 users/templates/users/user_detail.html:77 #: users/templates/users/user_profile.html:87 msgid "MFA" msgstr "多因子认证" @@ -1224,7 +1224,7 @@ msgid "Show" msgstr "显示" #: authentication/templates/authentication/_access_key_modal.html:66 -#: users/models/user.py:387 users/serializers/user.py:213 +#: users/models/user.py:387 users/serializers/user.py:217 #: users/templates/users/user_profile.html:94 #: users/templates/users/user_profile.html:163 #: users/templates/users/user_profile.html:166 @@ -1233,7 +1233,7 @@ msgid "Disable" msgstr "禁用" #: authentication/templates/authentication/_access_key_modal.html:67 -#: users/models/user.py:388 users/serializers/user.py:214 +#: users/models/user.py:388 users/serializers/user.py:218 #: users/templates/users/user_profile.html:92 #: users/templates/users/user_profile.html:170 msgid "Enable" @@ -1675,31 +1675,43 @@ msgstr "资产和节点至少选一个" msgid "System users" msgstr "系统用户" -#: perms/models/asset_permission.py:31 settings/serializers/settings.py:56 +#: perms/models/asset_permission.py:35 settings/serializers/settings.py:56 msgid "All" msgstr "全部" -#: perms/models/asset_permission.py:32 +#: perms/models/asset_permission.py:36 msgid "Connect" msgstr "连接" -#: perms/models/asset_permission.py:33 +#: perms/models/asset_permission.py:37 msgid "Upload file" msgstr "上传文件" -#: perms/models/asset_permission.py:34 +#: perms/models/asset_permission.py:38 msgid "Download file" msgstr "下载文件" -#: perms/models/asset_permission.py:35 +#: perms/models/asset_permission.py:39 msgid "Upload download" msgstr "上传下载" -#: perms/models/asset_permission.py:83 +#: perms/models/asset_permission.py:40 +msgid "Clipboard copy" +msgstr "剪切板复制" + +#: perms/models/asset_permission.py:41 +msgid "Clipboard paste" +msgstr "剪切板粘贴" + +#: perms/models/asset_permission.py:42 +msgid "Clipboard copy paste" +msgstr "剪切板复制粘贴" + +#: perms/models/asset_permission.py:93 msgid "Actions" msgstr "动作" -#: perms/models/asset_permission.py:87 templates/_nav.html:78 +#: perms/models/asset_permission.py:97 templates/_nav.html:78 #: users/templates/users/_user_detail_nav_header.html:31 msgid "Asset permission" msgstr "资产授权" @@ -2704,8 +2716,8 @@ msgid "Public key should not be the same as your old one." msgstr "不能和原来的密钥相同" #: users/forms/profile.py:137 users/forms/user.py:90 -#: users/serializers/user.py:177 users/serializers/user.py:258 -#: users/serializers/user.py:316 +#: users/serializers/user.py:181 users/serializers/user.py:262 +#: users/serializers/user.py:320 msgid "Not a valid ssh public key" msgstr "SSH密钥不合法" @@ -2795,7 +2807,7 @@ msgstr "最后更新密码日期" msgid "Administrator is the super user of system" msgstr "Administrator是初始的超级管理员" -#: users/serializers/user.py:69 users/serializers/user.py:229 +#: users/serializers/user.py:69 users/serializers/user.py:233 msgid "Is first login" msgstr "首次登录" @@ -2823,19 +2835,19 @@ msgstr "用户来源名" msgid "Role name" msgstr "角色名" -#: users/serializers/user.py:97 +#: users/serializers/user.py:101 msgid "Role limit to {}" msgstr "角色只能为 {}" -#: users/serializers/user.py:109 users/serializers/user.py:282 +#: users/serializers/user.py:113 users/serializers/user.py:286 msgid "Password does not match security rules" msgstr "密码不满足安全规则" -#: users/serializers/user.py:274 +#: users/serializers/user.py:278 msgid "The old password is incorrect" msgstr "旧密码错误" -#: users/serializers/user.py:288 +#: users/serializers/user.py:292 msgid "The newly set password is inconsistent" msgstr "两次密码不一致" @@ -2849,7 +2861,7 @@ msgstr "安全令牌验证" #: users/templates/users/_base_otp.html:14 users/templates/users/_user.html:13 #: users/templates/users/user_profile_update.html:55 -#: xpack/plugins/cloud/models.py:119 xpack/plugins/cloud/serializers.py:81 +#: xpack/plugins/cloud/models.py:119 xpack/plugins/cloud/serializers.py:82 msgid "Account" msgstr "账户" @@ -3736,7 +3748,7 @@ msgstr "" msgid "Cloud account" msgstr "云账号" -#: xpack/plugins/cloud/models.py:122 xpack/plugins/cloud/serializers.py:58 +#: xpack/plugins/cloud/models.py:122 xpack/plugins/cloud/serializers.py:59 msgid "Regions" msgstr "地域" @@ -3744,7 +3756,7 @@ msgstr "地域" msgid "Instances" msgstr "实例" -#: xpack/plugins/cloud/models.py:137 xpack/plugins/cloud/serializers.py:85 +#: xpack/plugins/cloud/models.py:137 xpack/plugins/cloud/serializers.py:86 msgid "Always update" msgstr "总是更新" @@ -3860,15 +3872,15 @@ msgstr "拉美-圣地亚哥" msgid "Tencent Cloud" msgstr "腾讯云" -#: xpack/plugins/cloud/serializers.py:56 +#: xpack/plugins/cloud/serializers.py:57 msgid "History count" msgstr "执行次数" -#: xpack/plugins/cloud/serializers.py:57 +#: xpack/plugins/cloud/serializers.py:58 msgid "Instance count" msgstr "实例个数" -#: xpack/plugins/cloud/serializers.py:84 +#: xpack/plugins/cloud/serializers.py:85 #: xpack/plugins/gathered_user/serializers.py:20 msgid "Periodic display" msgstr "定时执行" @@ -3957,6 +3969,12 @@ msgstr "企业版" msgid "Ultimate edition" msgstr "旗舰版" +#~ msgid "GUI copy" +#~ msgstr "GUI 复制" + +#~ msgid "GUI paste" +#~ msgstr "GUI 粘贴" + #~ msgid "Covered always" #~ msgstr "总是被覆盖" diff --git a/apps/perms/migrations/0011_auto_20200721_1739.py b/apps/perms/migrations/0011_auto_20200721_1739.py new file mode 100644 index 000000000..7e6b37188 --- /dev/null +++ b/apps/perms/migrations/0011_auto_20200721_1739.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.10 on 2020-07-21 09:39 + +from django.db import migrations, models + +from django.db.models import F +from ..models.asset_permission import Action + + +def migrate_asset_permission(apps, schema_editor): + # 已有的资产权限默认拥有剪切板复制粘贴动作 + AssetPermission = apps.get_model('perms', 'AssetPermission') + AssetPermission.objects.all().update(actions=F('actions').bitor(Action.CLIPBOARD_COPY_PASTE)) + + +class Migration(migrations.Migration): + + dependencies = [ + ('perms', '0010_auto_20191218_1705'), + ] + + operations = [ + migrations.AlterField( + model_name='assetpermission', + name='actions', + field=models.IntegerField(choices=[(255, 'All'), (1, 'Connect'), (2, 'Upload file'), (4, 'Download file'), (6, 'Upload download'), (8, 'Clipboard copy'), (16, 'Clipboard paste'), (24, 'Clipboard copy paste')], default=255, verbose_name='Actions'), + ), + migrations.RunPython(migrate_asset_permission) + ] diff --git a/apps/perms/models/asset_permission.py b/apps/perms/models/asset_permission.py index 8552edc74..f2755a568 100644 --- a/apps/perms/models/asset_permission.py +++ b/apps/perms/models/asset_permission.py @@ -21,11 +21,15 @@ logger = logging.getLogger(__name__) class Action: NONE = 0 - CONNECT = 0b00000001 - UPLOAD = 0b00000010 - DOWNLOAD = 0b00000100 + + CONNECT = 0b1 + UPLOAD = 0b1 << 1 + DOWNLOAD = 0b1 << 2 + CLIPBOARD_COPY = 0b1 << 3 + CLIPBOARD_PASTE = 0b1 << 4 + ALL = 0xff UPDOWNLOAD = UPLOAD | DOWNLOAD - ALL = 0b11111111 + CLIPBOARD_COPY_PASTE = CLIPBOARD_COPY | CLIPBOARD_PASTE DB_CHOICES = ( (ALL, _('All')), @@ -33,6 +37,9 @@ class Action: (UPLOAD, _('Upload file')), (DOWNLOAD, _('Download file')), (UPDOWNLOAD, _("Upload download")), + (CLIPBOARD_COPY, _('Clipboard copy')), + (CLIPBOARD_PASTE, _('Clipboard paste')), + (CLIPBOARD_COPY_PASTE, _('Clipboard copy paste')) ) NAME_MAP = { @@ -41,9 +48,12 @@ class Action: UPLOAD: "upload_file", DOWNLOAD: "download_file", UPDOWNLOAD: "updownload", + CLIPBOARD_COPY: 'clipboard_copy', + CLIPBOARD_PASTE: 'clipboard_paste', + CLIPBOARD_COPY_PASTE: 'clipboard_copy_paste' } - NAME_MAP_REVERSE = dict({v: k for k, v in NAME_MAP.items()}) + NAME_MAP_REVERSE = {v: k for k, v in NAME_MAP.items()} CHOICES = [] for i, j in DB_CHOICES: CHOICES.append((NAME_MAP[i], j))