未验证 提交 16864ca3 编写于 作者: B BaiJiangJie 提交者: GitHub

[Update] 用户列表添加移除操作(在其他组织中) (#3513)

* [Update] 用户列表添加移除操作(在其他组织中)

* [Update] 用户列表添加移除操作(在其他组织中)2
上级 c5785e17
...@@ -149,11 +149,7 @@ class CanUpdateDeleteUser(permissions.BasePermission): ...@@ -149,11 +149,7 @@ class CanUpdateDeleteUser(permissions.BasePermission):
return False return False
if obj.is_super_auditor: if obj.is_super_auditor:
return False return False
if obj.is_org_admin: if obj.can_admin_current_org:
return False
if len(obj.audit_orgs) > 1:
return False
if len(obj.user_orgs) > 1:
return False return False
return True return True
...@@ -174,12 +170,6 @@ class CanUpdateDeleteUser(permissions.BasePermission): ...@@ -174,12 +170,6 @@ class CanUpdateDeleteUser(permissions.BasePermission):
return False return False
if obj.is_super_auditor: if obj.is_super_auditor:
return False return False
if obj.is_org_admin:
return False
if len(obj.audit_orgs) > 1:
return False
if len(obj.user_orgs) > 1:
return False
return True return True
def has_object_permission(self, request, view, obj): def has_object_permission(self, request, view, obj):
......
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n" "Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-06 15:21+0800\n" "POT-Creation-Date: 2019-12-06 19:03+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n" "Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n" "Language-Team: Jumpserver team<ibuler@qq.com>\n"
...@@ -146,7 +146,7 @@ msgstr "资产" ...@@ -146,7 +146,7 @@ msgstr "资产"
#: terminal/models.py:350 terminal/templates/terminal/base_storage_list.html:32 #: terminal/models.py:350 terminal/templates/terminal/base_storage_list.html:32
#: terminal/templates/terminal/terminal_detail.html:43 #: terminal/templates/terminal/terminal_detail.html:43
#: terminal/templates/terminal/terminal_list.html:30 users/forms.py:162 #: terminal/templates/terminal/terminal_list.html:30 users/forms.py:162
#: users/models/group.py:14 users/models/user.py:433 #: users/models/group.py:14 users/models/user.py:443
#: users/templates/users/_select_user_modal.html:13 #: users/templates/users/_select_user_modal.html:13
#: users/templates/users/user_asset_permission.html:54 #: users/templates/users/user_asset_permission.html:54
#: users/templates/users/user_asset_permission.html:174 #: users/templates/users/user_asset_permission.html:174
...@@ -202,7 +202,7 @@ msgstr "参数" ...@@ -202,7 +202,7 @@ msgstr "参数"
#: orgs/models.py:16 perms/models/base.py:54 #: orgs/models.py:16 perms/models/base.py:54
#: perms/templates/perms/asset_permission_detail.html:93 #: perms/templates/perms/asset_permission_detail.html:93
#: perms/templates/perms/remote_app_permission_detail.html:85 #: perms/templates/perms/remote_app_permission_detail.html:85
#: users/models/user.py:474 users/serializers/group.py:32 #: users/models/user.py:484 users/serializers/group.py:32
#: users/templates/users/user_detail.html:112 #: users/templates/users/user_detail.html:112
#: xpack/plugins/change_auth_plan/models.py:109 #: xpack/plugins/change_auth_plan/models.py:109
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:113 #: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:113
...@@ -266,7 +266,7 @@ msgstr "创建日期" ...@@ -266,7 +266,7 @@ msgstr "创建日期"
#: terminal/models.py:357 terminal/templates/terminal/base_storage_list.html:34 #: terminal/models.py:357 terminal/templates/terminal/base_storage_list.html:34
#: terminal/templates/terminal/terminal_detail.html:63 #: terminal/templates/terminal/terminal_detail.html:63
#: tickets/templates/tickets/ticket_detail.html:104 users/models/group.py:15 #: tickets/templates/tickets/ticket_detail.html:104 users/models/group.py:15
#: users/models/user.py:466 users/templates/users/user_detail.html:130 #: users/models/user.py:476 users/templates/users/user_detail.html:130
#: users/templates/users/user_group_detail.html:62 #: users/templates/users/user_group_detail.html:62
#: users/templates/users/user_group_list.html:37 #: users/templates/users/user_group_list.html:37
#: users/templates/users/user_profile.html:138 #: users/templates/users/user_profile.html:138
...@@ -361,7 +361,7 @@ msgstr "重置" ...@@ -361,7 +361,7 @@ msgstr "重置"
#: users/templates/users/_user.html:52 #: users/templates/users/_user.html:52
#: users/templates/users/forgot_password.html:42 #: users/templates/users/forgot_password.html:42
#: users/templates/users/user_bulk_update.html:24 #: users/templates/users/user_bulk_update.html:24
#: users/templates/users/user_list.html:57 #: users/templates/users/user_list.html:61
#: users/templates/users/user_password_update.html:76 #: users/templates/users/user_password_update.html:76
#: users/templates/users/user_profile_update.html:68 #: users/templates/users/user_profile_update.html:68
#: users/templates/users/user_pubkey_update.html:81 #: users/templates/users/user_pubkey_update.html:81
...@@ -431,8 +431,8 @@ msgstr "详情" ...@@ -431,8 +431,8 @@ msgstr "详情"
#: users/templates/users/user_group_list.html:20 #: users/templates/users/user_group_list.html:20
#: users/templates/users/user_group_list.html:71 #: users/templates/users/user_group_list.html:71
#: users/templates/users/user_list.html:20 #: users/templates/users/user_list.html:20
#: users/templates/users/user_list.html:103 #: users/templates/users/user_list.html:107
#: users/templates/users/user_list.html:106 #: users/templates/users/user_list.html:110
#: users/templates/users/user_profile.html:181 #: users/templates/users/user_profile.html:181
#: users/templates/users/user_profile.html:191 #: users/templates/users/user_profile.html:191
#: users/templates/users/user_profile.html:201 #: users/templates/users/user_profile.html:201
...@@ -477,8 +477,8 @@ msgstr "更新" ...@@ -477,8 +477,8 @@ msgstr "更新"
#: users/templates/users/user_detail.html:31 #: users/templates/users/user_detail.html:31
#: users/templates/users/user_group_detail.html:27 #: users/templates/users/user_group_detail.html:27
#: users/templates/users/user_group_list.html:73 #: users/templates/users/user_group_list.html:73
#: users/templates/users/user_list.html:111 #: users/templates/users/user_list.html:117
#: users/templates/users/user_list.html:115 #: users/templates/users/user_list.html:121
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:33 #: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:33
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:58 #: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_list.html:58
#: xpack/plugins/cloud/templates/cloud/account_detail.html:27 #: xpack/plugins/cloud/templates/cloud/account_detail.html:27
...@@ -719,7 +719,7 @@ msgstr "SSH网关,支持代理SSH,RDP和VNC" ...@@ -719,7 +719,7 @@ msgstr "SSH网关,支持代理SSH,RDP和VNC"
#: ops/models/adhoc.py:189 perms/templates/perms/asset_permission_list.html:205 #: ops/models/adhoc.py:189 perms/templates/perms/asset_permission_list.html:205
#: perms/templates/perms/remote_app_permission_user.html:50 #: perms/templates/perms/remote_app_permission_user.html:50
#: settings/templates/settings/_ldap_list_users_modal.html:31 users/forms.py:14 #: settings/templates/settings/_ldap_list_users_modal.html:31 users/forms.py:14
#: users/forms.py:161 users/models/user.py:431 #: users/forms.py:161 users/models/user.py:441
#: users/templates/users/_select_user_modal.html:14 #: users/templates/users/_select_user_modal.html:14
#: users/templates/users/user_detail.html:68 #: users/templates/users/user_detail.html:68
#: users/templates/users/user_list.html:36 #: users/templates/users/user_list.html:36
...@@ -760,7 +760,7 @@ msgstr "密码" ...@@ -760,7 +760,7 @@ msgstr "密码"
#: assets/forms/user.py:30 assets/serializers/asset_user.py:71 #: assets/forms/user.py:30 assets/serializers/asset_user.py:71
#: assets/templates/assets/_asset_user_auth_update_modal.html:27 #: assets/templates/assets/_asset_user_auth_update_modal.html:27
#: users/models/user.py:460 #: users/models/user.py:470
msgid "Private key" msgid "Private key"
msgstr "ssh私钥" msgstr "ssh私钥"
...@@ -975,7 +975,7 @@ msgstr "带宽" ...@@ -975,7 +975,7 @@ msgstr "带宽"
msgid "Contact" msgid "Contact"
msgstr "联系人" msgstr "联系人"
#: assets/models/cluster.py:22 users/models/user.py:452 #: assets/models/cluster.py:22 users/models/user.py:462
#: users/templates/users/user_detail.html:77 #: users/templates/users/user_detail.html:77
msgid "Phone" msgid "Phone"
msgstr "手机" msgstr "手机"
...@@ -1001,7 +1001,7 @@ msgid "Default" ...@@ -1001,7 +1001,7 @@ msgid "Default"
msgstr "默认" msgstr "默认"
#: assets/models/cluster.py:36 assets/models/label.py:14 #: assets/models/cluster.py:36 assets/models/label.py:14
#: users/models/user.py:575 #: users/models/user.py:585
msgid "System" msgid "System"
msgstr "系统" msgstr "系统"
...@@ -1142,7 +1142,7 @@ msgstr "默认资产组" ...@@ -1142,7 +1142,7 @@ msgstr "默认资产组"
#: tickets/models/ticket.py:128 tickets/templates/tickets/ticket_detail.html:32 #: tickets/models/ticket.py:128 tickets/templates/tickets/ticket_detail.html:32
#: tickets/templates/tickets/ticket_list.html:34 #: tickets/templates/tickets/ticket_list.html:34
#: tickets/templates/tickets/ticket_list.html:103 users/forms.py:339 #: tickets/templates/tickets/ticket_list.html:103 users/forms.py:339
#: users/models/user.py:148 users/models/user.py:164 users/models/user.py:563 #: users/models/user.py:148 users/models/user.py:164 users/models/user.py:573
#: users/serializers/group.py:21 #: users/serializers/group.py:21
#: users/templates/users/user_asset_permission.html:55 #: users/templates/users/user_asset_permission.html:55
#: users/templates/users/user_asset_permission.html:84 #: users/templates/users/user_asset_permission.html:84
...@@ -1303,7 +1303,7 @@ msgid "Backend" ...@@ -1303,7 +1303,7 @@ msgid "Backend"
msgstr "后端" msgstr "后端"
#: assets/serializers/asset_user.py:67 users/forms.py:282 #: assets/serializers/asset_user.py:67 users/forms.py:282
#: users/models/user.py:463 users/templates/users/first_login.html:42 #: users/models/user.py:473 users/templates/users/first_login.html:42
#: users/templates/users/user_password_update.html:49 #: users/templates/users/user_password_update.html:49
#: users/templates/users/user_profile.html:69 #: users/templates/users/user_profile.html:69
#: users/templates/users/user_profile_update.html:46 #: users/templates/users/user_profile_update.html:46
...@@ -1727,7 +1727,7 @@ msgstr "选择节点" ...@@ -1727,7 +1727,7 @@ msgstr "选择节点"
#: users/templates/users/user_detail.html:548 #: users/templates/users/user_detail.html:548
#: users/templates/users/user_group_create_update.html:28 #: users/templates/users/user_group_create_update.html:28
#: users/templates/users/user_group_list.html:120 #: users/templates/users/user_group_list.html:120
#: users/templates/users/user_list.html:256 #: users/templates/users/user_list.html:276
#: xpack/plugins/cloud/templates/cloud/account_create_update.html:34 #: xpack/plugins/cloud/templates/cloud/account_create_update.html:34
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:54 #: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:54
#: xpack/plugins/gathered_user/templates/gathered_user/task_create_update.html:45 #: xpack/plugins/gathered_user/templates/gathered_user/task_create_update.html:45
...@@ -1784,8 +1784,8 @@ msgstr "创建管理用户" ...@@ -1784,8 +1784,8 @@ msgstr "创建管理用户"
#: assets/templates/assets/system_user_list.html:217 #: assets/templates/assets/system_user_list.html:217
#: users/templates/users/user_group_list.html:164 #: users/templates/users/user_group_list.html:164
#: users/templates/users/user_group_list.html:195 #: users/templates/users/user_group_list.html:195
#: users/templates/users/user_list.html:165 #: users/templates/users/user_list.html:184
#: users/templates/users/user_list.html:197 #: users/templates/users/user_list.html:216
#: xpack/plugins/vault/templates/vault/vault.html:200 #: xpack/plugins/vault/templates/vault/vault.html:200
msgid "Please select file" msgid "Please select file"
msgstr "选择文件" msgstr "选择文件"
...@@ -1875,12 +1875,12 @@ msgid "Hardware" ...@@ -1875,12 +1875,12 @@ msgid "Hardware"
msgstr "硬件" msgstr "硬件"
#: assets/templates/assets/asset_list.html:109 #: assets/templates/assets/asset_list.html:109
#: users/templates/users/user_list.html:50 #: users/templates/users/user_list.html:51
msgid "Delete selected" msgid "Delete selected"
msgstr "批量删除" msgstr "批量删除"
#: assets/templates/assets/asset_list.html:110 #: assets/templates/assets/asset_list.html:110
#: users/templates/users/user_list.html:51 #: users/templates/users/user_list.html:55
msgid "Update selected" msgid "Update selected"
msgstr "批量更新" msgstr "批量更新"
...@@ -1889,12 +1889,12 @@ msgid "Remove from this node" ...@@ -1889,12 +1889,12 @@ msgid "Remove from this node"
msgstr "从节点移除" msgstr "从节点移除"
#: assets/templates/assets/asset_list.html:112 #: assets/templates/assets/asset_list.html:112
#: users/templates/users/user_list.html:52 #: users/templates/users/user_list.html:56
msgid "Deactive selected" msgid "Deactive selected"
msgstr "禁用所选" msgstr "禁用所选"
#: assets/templates/assets/asset_list.html:113 #: assets/templates/assets/asset_list.html:113
#: users/templates/users/user_list.html:53 #: users/templates/users/user_list.html:57
msgid "Active selected" msgid "Active selected"
msgstr "激活所选" msgstr "激活所选"
...@@ -1928,7 +1928,7 @@ msgstr "显示所有子节点资产" ...@@ -1928,7 +1928,7 @@ msgstr "显示所有子节点资产"
#: users/templates/users/user_detail.html:474 #: users/templates/users/user_detail.html:474
#: users/templates/users/user_detail.html:542 #: users/templates/users/user_detail.html:542
#: users/templates/users/user_group_list.html:114 #: users/templates/users/user_group_list.html:114
#: users/templates/users/user_list.html:250 #: users/templates/users/user_list.html:270
#: xpack/plugins/interface/templates/interface/interface.html:97 #: xpack/plugins/interface/templates/interface/interface.html:97
msgid "Are you sure?" msgid "Are you sure?"
msgstr "你确认吗?" msgstr "你确认吗?"
...@@ -1943,7 +1943,7 @@ msgstr "删除选择资产" ...@@ -1943,7 +1943,7 @@ msgstr "删除选择资产"
#: users/templates/users/user_detail.html:478 #: users/templates/users/user_detail.html:478
#: users/templates/users/user_detail.html:546 #: users/templates/users/user_detail.html:546
#: users/templates/users/user_group_list.html:118 #: users/templates/users/user_group_list.html:118
#: users/templates/users/user_list.html:254 #: users/templates/users/user_list.html:274
#: xpack/plugins/interface/templates/interface/interface.html:101 #: xpack/plugins/interface/templates/interface/interface.html:101
msgid "Cancel" msgid "Cancel"
msgstr "取消" msgstr "取消"
...@@ -2326,7 +2326,7 @@ msgstr "Agent" ...@@ -2326,7 +2326,7 @@ msgstr "Agent"
#: audits/models.py:86 audits/templates/audits/login_log_list.html:62 #: audits/models.py:86 audits/templates/audits/login_log_list.html:62
#: authentication/templates/authentication/_mfa_confirm_modal.html:14 #: authentication/templates/authentication/_mfa_confirm_modal.html:14
#: users/forms.py:194 users/models/user.py:455 #: users/forms.py:194 users/models/user.py:465
#: users/templates/users/first_login.html:45 #: users/templates/users/first_login.html:45
msgid "MFA" msgid "MFA"
msgstr "MFA" msgstr "MFA"
...@@ -2581,14 +2581,14 @@ msgid "Show" ...@@ -2581,14 +2581,14 @@ msgid "Show"
msgstr "显示" msgstr "显示"
#: authentication/templates/authentication/_access_key_modal.html:66 #: authentication/templates/authentication/_access_key_modal.html:66
#: users/models/user.py:355 users/templates/users/user_profile.html:94 #: users/models/user.py:365 users/templates/users/user_profile.html:94
#: users/templates/users/user_profile.html:163 #: users/templates/users/user_profile.html:163
#: users/templates/users/user_profile.html:166 #: users/templates/users/user_profile.html:166
msgid "Disable" msgid "Disable"
msgstr "禁用" msgstr "禁用"
#: authentication/templates/authentication/_access_key_modal.html:67 #: authentication/templates/authentication/_access_key_modal.html:67
#: users/models/user.py:356 users/templates/users/user_profile.html:92 #: users/models/user.py:366 users/templates/users/user_profile.html:92
#: users/templates/users/user_profile.html:170 #: users/templates/users/user_profile.html:170
msgid "Enable" msgid "Enable"
msgstr "启用" msgstr "启用"
...@@ -3235,7 +3235,7 @@ msgstr "提示:RDP 协议不支持单独控制上传或下载文件" ...@@ -3235,7 +3235,7 @@ msgstr "提示:RDP 协议不支持单独控制上传或下载文件"
#: perms/templates/perms/asset_permission_list.html:206 #: perms/templates/perms/asset_permission_list.html:206
#: perms/templates/perms/remote_app_permission_list.html:16 #: perms/templates/perms/remote_app_permission_list.html:16
#: templates/_nav.html:21 users/forms.py:313 users/models/group.py:26 #: templates/_nav.html:21 users/forms.py:313 users/models/group.py:26
#: users/models/user.py:439 users/templates/users/_select_user_modal.html:16 #: users/models/user.py:449 users/templates/users/_select_user_modal.html:16
#: users/templates/users/user_asset_permission.html:56 #: users/templates/users/user_asset_permission.html:56
#: users/templates/users/user_asset_permission.html:87 #: users/templates/users/user_asset_permission.html:87
#: users/templates/users/user_detail.html:222 #: users/templates/users/user_detail.html:222
...@@ -3283,7 +3283,7 @@ msgstr "资产授权" ...@@ -3283,7 +3283,7 @@ msgstr "资产授权"
#: perms/models/base.py:53 #: perms/models/base.py:53
#: perms/templates/perms/asset_permission_detail.html:85 #: perms/templates/perms/asset_permission_detail.html:85
#: perms/templates/perms/remote_app_permission_detail.html:77 #: perms/templates/perms/remote_app_permission_detail.html:77
#: users/models/user.py:471 users/templates/users/user_detail.html:108 #: users/models/user.py:481 users/templates/users/user_detail.html:108
#: users/templates/users/user_profile.html:120 #: users/templates/users/user_profile.html:120
msgid "Date expired" msgid "Date expired"
msgstr "失效日期" msgstr "失效日期"
...@@ -3858,7 +3858,7 @@ msgid "Refresh cache" ...@@ -3858,7 +3858,7 @@ msgid "Refresh cache"
msgstr "刷新缓存" msgstr "刷新缓存"
#: settings/templates/settings/_ldap_list_users_modal.html:33 #: settings/templates/settings/_ldap_list_users_modal.html:33
#: users/models/user.py:435 users/templates/users/user_detail.html:72 #: users/models/user.py:445 users/templates/users/user_detail.html:72
#: users/templates/users/user_profile.html:59 #: users/templates/users/user_profile.html:59
msgid "Email" msgid "Email"
msgstr "邮件" msgstr "邮件"
...@@ -4827,11 +4827,11 @@ msgstr "工单列表" ...@@ -4827,11 +4827,11 @@ msgstr "工单列表"
msgid "Ticket detail" msgid "Ticket detail"
msgstr "工单详情" msgstr "工单详情"
#: users/api/user.py:174 #: users/api/user.py:180
msgid "Could not reset self otp, use profile reset instead" msgid "Could not reset self otp, use profile reset instead"
msgstr "不能再该页面重置MFA, 请去个人信息页面重置" msgstr "不能再该页面重置MFA, 请去个人信息页面重置"
#: users/forms.py:47 users/models/user.py:443 #: users/forms.py:47 users/models/user.py:453
#: users/templates/users/_select_user_modal.html:15 #: users/templates/users/_select_user_modal.html:15
#: users/templates/users/user_detail.html:88 #: users/templates/users/user_detail.html:88
#: users/templates/users/user_list.html:37 #: users/templates/users/user_list.html:37
...@@ -4839,7 +4839,7 @@ msgstr "不能再该页面重置MFA, 请去个人信息页面重置" ...@@ -4839,7 +4839,7 @@ msgstr "不能再该页面重置MFA, 请去个人信息页面重置"
msgid "Role" msgid "Role"
msgstr "角色" msgstr "角色"
#: users/forms.py:51 users/models/user.py:478 #: users/forms.py:51 users/models/user.py:488
#: users/templates/users/user_detail.html:104 #: users/templates/users/user_detail.html:104
#: users/templates/users/user_list.html:39 #: users/templates/users/user_list.html:39
#: users/templates/users/user_profile.html:102 #: users/templates/users/user_profile.html:102
...@@ -4957,7 +4957,7 @@ msgstr "选择用户" ...@@ -4957,7 +4957,7 @@ msgstr "选择用户"
msgid "User auth from {}, go there change password" msgid "User auth from {}, go there change password"
msgstr "用户认证源来自 {}, 请去相应系统修改密码" msgstr "用户认证源来自 {}, 请去相应系统修改密码"
#: users/models/user.py:147 users/models/user.py:571 #: users/models/user.py:147 users/models/user.py:581
msgid "Administrator" msgid "Administrator"
msgstr "管理员" msgstr "管理员"
...@@ -4978,27 +4978,27 @@ msgstr "组织管理员" ...@@ -4978,27 +4978,27 @@ msgstr "组织管理员"
msgid "Org auditor" msgid "Org auditor"
msgstr "组织审计员" msgstr "组织审计员"
#: users/models/user.py:357 users/templates/users/user_profile.html:90 #: users/models/user.py:367 users/templates/users/user_profile.html:90
msgid "Force enable" msgid "Force enable"
msgstr "强制启用" msgstr "强制启用"
#: users/models/user.py:423 #: users/models/user.py:433
msgid "Local" msgid "Local"
msgstr "数据库" msgstr "数据库"
#: users/models/user.py:446 #: users/models/user.py:456
msgid "Avatar" msgid "Avatar"
msgstr "头像" msgstr "头像"
#: users/models/user.py:449 users/templates/users/user_detail.html:83 #: users/models/user.py:459 users/templates/users/user_detail.html:83
msgid "Wechat" msgid "Wechat"
msgstr "微信" msgstr "微信"
#: users/models/user.py:482 #: users/models/user.py:492
msgid "Date password last updated" msgid "Date password last updated"
msgstr "最后更新密码日期" msgstr "最后更新密码日期"
#: users/models/user.py:574 #: users/models/user.py:584
msgid "Administrator is the super user of system" msgid "Administrator is the super user of system"
msgstr "Administrator是初始的超级管理员" msgstr "Administrator是初始的超级管理员"
...@@ -5372,28 +5372,52 @@ msgstr "用户组删除" ...@@ -5372,28 +5372,52 @@ msgstr "用户组删除"
msgid "UserGroup Deleting failed." msgid "UserGroup Deleting failed."
msgstr "用户组删除失败" msgstr "用户组删除失败"
#: users/templates/users/user_list.html:251 #: users/templates/users/user_list.html:53
msgid "Remove selected"
msgstr "批量移除"
#: users/templates/users/user_list.html:129
#: users/templates/users/user_list.html:133
msgid "Remove"
msgstr "移除"
#: users/templates/users/user_list.html:271
msgid "This will delete the selected users !!!" msgid "This will delete the selected users !!!"
msgstr "删除选中用户 !!!" msgstr "删除选中用户 !!!"
#: users/templates/users/user_list.html:262 #: users/templates/users/user_list.html:282
msgid "User Deleted." msgid "User Deleting failed."
msgstr "已被删除" msgstr "用户删除失败"
#: users/templates/users/user_list.html:263 #: users/templates/users/user_list.html:283
#: users/templates/users/user_list.html:267
msgid "User Delete" msgid "User Delete"
msgstr "删除" msgstr "删除"
#: users/templates/users/user_list.html:266 #: users/templates/users/user_list.html:305
msgid "User Deleting failed." msgid "This will remove the selected users !!"
msgstr "用户删除失败" msgstr "移除选中用户 !!!"
#: users/templates/users/user_list.html:307
msgid "User Removing failed."
msgstr "用户移除失败"
#: users/templates/users/user_list.html:308
msgid "User Remove"
msgstr "用户移除"
#: users/templates/users/user_list.html:327 #: users/templates/users/user_list.html:357
msgid "Are you sure about removing it?"
msgstr "您确定移除吗?"
#: users/templates/users/user_list.html:358
msgid "Remove the success"
msgstr "移除成功"
#: users/templates/users/user_list.html:363
msgid "User is expired" msgid "User is expired"
msgstr "用户已失效" msgstr "用户已失效"
#: users/templates/users/user_list.html:330 #: users/templates/users/user_list.html:366
msgid "User is inactive" msgid "User is inactive"
msgstr "用户已禁用" msgstr "用户已禁用"
...@@ -6503,6 +6527,9 @@ msgstr "密码匣子" ...@@ -6503,6 +6527,9 @@ msgstr "密码匣子"
msgid "vault create" msgid "vault create"
msgstr "创建" msgstr "创建"
#~ msgid "User Deleted."
#~ msgstr "已被删除"
#~ msgid "Search no entry matched in ou {}" #~ msgid "Search no entry matched in ou {}"
#~ msgstr "在ou:{}中没有匹配条目" #~ msgstr "在ou:{}中没有匹配条目"
...@@ -6556,9 +6583,6 @@ msgstr "创建" ...@@ -6556,9 +6583,6 @@ msgstr "创建"
#~ msgid "Delete failed" #~ msgid "Delete failed"
#~ msgstr "删除失败" #~ msgstr "删除失败"
#~ msgid "Are you sure about deleting it?"
#~ msgstr "您确定删除吗?"
#~ msgid "The connection fails" #~ msgid "The connection fails"
#~ msgstr "连接失败" #~ msgstr "连接失败"
...@@ -6588,9 +6612,6 @@ msgstr "创建" ...@@ -6588,9 +6612,6 @@ msgstr "创建"
#~ msgid "Approve selected" #~ msgid "Approve selected"
#~ msgstr "同意所选" #~ msgstr "同意所选"
#~ msgid "Reject selected"
#~ msgstr "拒绝所选"
#~ msgid "" #~ msgid ""
#~ "\n" #~ "\n"
#~ " <div>\n" #~ " <div>\n"
......
...@@ -316,7 +316,7 @@ function requestApi(props) { ...@@ -316,7 +316,7 @@ function requestApi(props) {
} }
// Sweet Alert for Delete // Sweet Alert for Delete
function objectDelete(obj, name, url, redirectTo) { function objectDelete(obj, name, url, redirectTo, title, success_message) {
function doDelete() { function doDelete() {
var body = {}; var body = {};
var success = function () { var success = function () {
...@@ -335,14 +335,14 @@ function objectDelete(obj, name, url, redirectTo) { ...@@ -335,14 +335,14 @@ function objectDelete(obj, name, url, redirectTo) {
url: url, url: url,
body: JSON.stringify(body), body: JSON.stringify(body),
method: 'DELETE', method: 'DELETE',
success_message: gettext("Delete the success"), success_message: success_message || gettext("Delete the success"),
success: success, success: success,
error: fail error: fail
}); });
} }
swal({ swal({
title: gettext('Are you sure about deleting it?'), title: title || gettext('Are you sure about deleting it?'),
text: " [" + name + "] ", text: " [" + name + "] ",
type: "warning", type: "warning",
showCancelButton: true, showCancelButton: true,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<script src="{% static "js/plugins/toastr/toastr.min.js" %}"></script> <script src="{% static "js/plugins/toastr/toastr.min.js" %}"></script>
<script src="{% static "js/inspinia.js" %}"></script> <script src="{% static "js/inspinia.js" %}"></script>
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script> <script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
<script src="{% static "js/jumpserver.js" %}?v=5"></script> <script src="{% static "js/jumpserver.js" %}?v=6"></script>
<script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script> <script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script>
<script src="{% static 'js/plugins/select2/i18n/zh-CN.js' %}"></script> <script src="{% static 'js/plugins/select2/i18n/zh-CN.js' %}"></script>
<script> <script>
......
...@@ -67,6 +67,12 @@ class UserViewSet(CommonApiMixin, UserQuerysetMixin, BulkModelViewSet): ...@@ -67,6 +67,12 @@ class UserViewSet(CommonApiMixin, UserQuerysetMixin, BulkModelViewSet):
self.permission_classes = (IsSuperUser,) self.permission_classes = (IsSuperUser,)
return super().get_permissions() return super().get_permissions()
def perform_destroy(self, instance):
if current_org.is_real():
instance.remove()
else:
return super().perform_destroy(instance)
def perform_bulk_destroy(self, objects): def perform_bulk_destroy(self, objects):
for obj in objects: for obj in objects:
self.check_object_permissions(self.request, obj) self.check_object_permissions(self.request, obj)
......
...@@ -267,6 +267,16 @@ class RoleMixin: ...@@ -267,6 +267,16 @@ class RoleMixin:
access_key = app.create_access_key() access_key = app.create_access_key()
return app, access_key return app, access_key
def remove(self):
if not current_org.is_real():
return
if self.can_user_current_org:
current_org.users.remove(self)
if self.can_admin_current_org:
current_org.admins.remove(self)
if self.can_audit_current_org:
current_org.auditors.remove(self)
class TokenMixin: class TokenMixin:
CACHE_KEY_USER_RESET_PASSWORD_PREFIX = "_KEY_USER_RESET_PASSWORD_{}" CACHE_KEY_USER_RESET_PASSWORD_PREFIX = "_KEY_USER_RESET_PASSWORD_{}"
......
...@@ -47,7 +47,11 @@ ...@@ -47,7 +47,11 @@
<div id="actions" class="hide"> <div id="actions" class="hide">
<div class="input-group"> <div class="input-group">
<select class="form-control m-b" style="width: auto" id="slct_bulk_update"> <select class="form-control m-b" style="width: auto" id="slct_bulk_update">
<option value="delete">{% trans 'Delete selected' %}</option> {% if CURRENT_ORG == 'DEFAULT' %}
<option value="delete">{% trans 'Delete selected' %}</option>
{% else %}
<option value="remove">{% trans 'Remove selected' %}</option>
{% endif %}
<option value="update">{% trans 'Update selected' %}</option> <option value="update">{% trans 'Update selected' %}</option>
<option value="deactive">{% trans 'Deactive selected' %}</option> <option value="deactive">{% trans 'Deactive selected' %}</option>
<option value="active">{% trans 'Active selected' %}</option> <option value="active">{% trans 'Active selected' %}</option>
...@@ -107,16 +111,31 @@ function initTable() { ...@@ -107,16 +111,31 @@ function initTable() {
} }
var del_btn = ""; var del_btn = "";
if (rowData.can_delete === false){ var rm_btn = "";
del_btn = '<a class="btn btn-xs btn-danger m-l-xs" disabled>{% trans "Delete" %}</a>' if ("{{ CURRENT_ORG }}" === 'DEFAULT'){
if (rowData.can_delete === false){
del_btn = '<a class="btn btn-xs btn-danger m-l-xs" disabled>{% trans "Delete" %}</a>'
.replace('{{ DEFAULT_PK }}', cellData) .replace('{{ DEFAULT_PK }}', cellData)
.replace('99991938', name); .replace('99991938', name);
} else { } else {
del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="{{ DEFAULT_PK }}" data-name="99991938">{% trans "Delete" %}</a>' del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-action="delete" data-uid="{{ DEFAULT_PK }}" data-name="99991938">{% trans "Delete" %}</a>'
.replace('{{ DEFAULT_PK }}', cellData) .replace('{{ DEFAULT_PK }}', cellData)
.replace('99991938', name); .replace('99991938', name);
}
$(td).html(update_btn + del_btn)
}
else{
if (rowData.can_delete === false){
rm_btn = '<a class="btn btn-xs btn-warning m-l-xs" disabled>{% trans "Remove" %}</a>'
.replace('{{ DEFAULT_PK }}', cellData)
.replace('99991938', name);
} else {
rm_btn = '<a class="btn btn-xs btn-warning m-l-xs btn_user_delete" data-action="remove" data-uid="{{ DEFAULT_PK }}" data-name="99991938">{% trans "Remove" %}</a>'
.replace('{{ DEFAULT_PK }}', cellData)
.replace('99991938', name);
}
$(td).html(update_btn + rm_btn)
} }
$(td).html(update_btn + del_btn)
}}], }}],
ajax_url: '{% url "api-users:user-list" %}', ajax_url: '{% url "api-users:user-list" %}',
columns: [ columns: [
...@@ -245,10 +264,11 @@ $(document).ready(function(){ ...@@ -245,10 +264,11 @@ $(document).ready(function(){
success: reloadPage success: reloadPage
}); });
} }
function doDelete() { function doDelete(props) {
props = props || {};
swal({ swal({
title: "{% trans 'Are you sure?' %}", title: "{% trans 'Are you sure?' %}",
text: "{% trans 'This will delete the selected users !!!' %}", text: props.text || "{% trans 'This will delete the selected users !!!' %}",
type: "warning", type: "warning",
showCancelButton: true, showCancelButton: true,
cancelButtonText: "{% trans 'Cancel' %}", cancelButtonText: "{% trans 'Cancel' %}",
...@@ -258,10 +278,6 @@ $(document).ready(function(){ ...@@ -258,10 +278,6 @@ $(document).ready(function(){
},function () { },function () {
function success(data) { function success(data) {
url = setUrlParam(the_url, 'spm', data.spm); url = setUrlParam(the_url, 'spm', data.spm);
function success() {
var msg = "{% trans 'User Deleted.' %}";
swal("{% trans 'User Delete' %}", msg, "success");
}
function fail() { function fail() {
var msg = "{% trans 'User Deleting failed.' %}"; var msg = "{% trans 'User Deleting failed.' %}";
swal("{% trans 'User Delete' %}", msg, "error"); swal("{% trans 'User Delete' %}", msg, "error");
...@@ -271,7 +287,7 @@ $(document).ready(function(){ ...@@ -271,7 +287,7 @@ $(document).ready(function(){
method:'DELETE', method:'DELETE',
flash_message:true, flash_message:true,
success:reloadPage, success:reloadPage,
error: fail error: props.fail || fail
}); });
} }
requestApi({ requestApi({
...@@ -284,6 +300,17 @@ $(document).ready(function(){ ...@@ -284,6 +300,17 @@ $(document).ready(function(){
}) })
} }
function doRemove(){
var props = {
text: "{% trans 'This will remove the selected users !!' %}",
fail: function fail(){
var msg = "{% trans 'User Removing failed.' %}";
swal("{% trans 'User Remove' %}", msg, "error");
}
};
doDelete(props);
}
function doUpdate() { function doUpdate() {
function fail(data) { function fail(data) {
toastr.error(JSON.parse(data)) toastr.error(JSON.parse(data))
...@@ -308,6 +335,9 @@ $(document).ready(function(){ ...@@ -308,6 +335,9 @@ $(document).ready(function(){
case 'delete': case 'delete':
doDelete(); doDelete();
break; break;
case 'remove':
doRemove();
break;
case 'update': case 'update':
doUpdate(); doUpdate();
break; break;
...@@ -321,8 +351,14 @@ $(document).ready(function(){ ...@@ -321,8 +351,14 @@ $(document).ready(function(){
var $this = $(this); var $this = $(this);
var name = $this.data('name'); var name = $this.data('name');
var uid = $this.data('uid'); var uid = $this.data('uid');
var action = $this.data('action');
var title, success_message = null;
if (action === 'remove'){
title = "{% trans 'Are you sure about removing it?' %}";
success_message = "{% trans 'Remove the success' %}";
}
var the_url = '{% url "api-users:user-detail" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", uid); var the_url = '{% url "api-users:user-detail" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", uid);
objectDelete($this, name, the_url); objectDelete($this, name, the_url, null, title, success_message);
}).on('click', '.expired', function () { }).on('click', '.expired', function () {
var msg = '{% trans "User is expired" %}'; var msg = '{% trans "User is expired" %}';
toastr.error(msg) toastr.error(msg)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册