Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gjl2004yn
jumpserver
提交
16864ca3
J
jumpserver
项目概览
gjl2004yn
/
jumpserver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jumpserver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
16864ca3
编写于
12月 09, 2019
作者:
B
BaiJiangJie
提交者:
GitHub
12月 09, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Update] 用户列表添加移除操作(在其他组织中) (#3513)
* [Update] 用户列表添加移除操作(在其他组织中) * [Update] 用户列表添加移除操作(在其他组织中)2
上级
c5785e17
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
149 addition
and
86 deletion
+149
-86
apps/common/permissions.py
apps/common/permissions.py
+1
-11
apps/locale/zh/LC_MESSAGES/django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
apps/locale/zh/LC_MESSAGES/django.po
apps/locale/zh/LC_MESSAGES/django.po
+78
-57
apps/static/js/jumpserver.js
apps/static/js/jumpserver.js
+3
-3
apps/templates/_foot_js.html
apps/templates/_foot_js.html
+1
-1
apps/users/api/user.py
apps/users/api/user.py
+6
-0
apps/users/models/user.py
apps/users/models/user.py
+10
-0
apps/users/templates/users/user_list.html
apps/users/templates/users/user_list.html
+50
-14
未找到文件。
apps/common/permissions.py
浏览文件 @
16864ca3
...
...
@@ -149,11 +149,7 @@ class CanUpdateDeleteUser(permissions.BasePermission):
return
False
if
obj
.
is_super_auditor
:
return
False
if
obj
.
is_org_admin
:
return
False
if
len
(
obj
.
audit_orgs
)
>
1
:
return
False
if
len
(
obj
.
user_orgs
)
>
1
:
if
obj
.
can_admin_current_org
:
return
False
return
True
...
...
@@ -174,12 +170,6 @@ class CanUpdateDeleteUser(permissions.BasePermission):
return
False
if
obj
.
is_super_auditor
:
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
def
has_object_permission
(
self
,
request
,
view
,
obj
):
...
...
apps/locale/zh/LC_MESSAGES/django.mo
浏览文件 @
16864ca3
无法预览此类型文件
apps/locale/zh/LC_MESSAGES/django.po
浏览文件 @
16864ca3
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-06 1
5:21
+0800\n"
"POT-Creation-Date: 2019-12-06 1
9:03
+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
...
...
@@ -146,7 +146,7 @@ msgstr "资产"
#: terminal/models.py:350 terminal/templates/terminal/base_storage_list.html:32
#: terminal/templates/terminal/terminal_detail.html:43
#: terminal/templates/terminal/terminal_list.html:30 users/forms.py:162
#: users/models/group.py:14 users/models/user.py:4
3
3
#: users/models/group.py:14 users/models/user.py:4
4
3
#: users/templates/users/_select_user_modal.html:13
#: users/templates/users/user_asset_permission.html:54
#: users/templates/users/user_asset_permission.html:174
...
...
@@ -202,7 +202,7 @@ msgstr "参数"
#: orgs/models.py:16 perms/models/base.py:54
#: perms/templates/perms/asset_permission_detail.html:93
#: perms/templates/perms/remote_app_permission_detail.html:85
#: users/models/user.py:4
7
4 users/serializers/group.py:32
#: users/models/user.py:4
8
4 users/serializers/group.py:32
#: users/templates/users/user_detail.html:112
#: xpack/plugins/change_auth_plan/models.py:109
#: xpack/plugins/change_auth_plan/templates/change_auth_plan/plan_detail.html:113
...
...
@@ -266,7 +266,7 @@ msgstr "创建日期"
#: terminal/models.py:357 terminal/templates/terminal/base_storage_list.html:34
#: terminal/templates/terminal/terminal_detail.html:63
#: tickets/templates/tickets/ticket_detail.html:104 users/models/group.py:15
#: users/models/user.py:4
6
6 users/templates/users/user_detail.html:130
#: users/models/user.py:4
7
6 users/templates/users/user_detail.html:130
#: users/templates/users/user_group_detail.html:62
#: users/templates/users/user_group_list.html:37
#: users/templates/users/user_profile.html:138
...
...
@@ -361,7 +361,7 @@ msgstr "重置"
#: users/templates/users/_user.html:52
#: users/templates/users/forgot_password.html:42
#: 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_profile_update.html:68
#: users/templates/users/user_pubkey_update.html:81
...
...
@@ -431,8 +431,8 @@ msgstr "详情"
#: users/templates/users/user_group_list.html:20
#: users/templates/users/user_group_list.html:71
#: users/templates/users/user_list.html:20
#: users/templates/users/user_list.html:10
3
#: users/templates/users/user_list.html:1
06
#: users/templates/users/user_list.html:10
7
#: users/templates/users/user_list.html:1
10
#: users/templates/users/user_profile.html:181
#: users/templates/users/user_profile.html:191
#: users/templates/users/user_profile.html:201
...
...
@@ -477,8 +477,8 @@ msgstr "更新"
#: users/templates/users/user_detail.html:31
#: users/templates/users/user_group_detail.html:27
#: users/templates/users/user_group_list.html:73
#: users/templates/users/user_list.html:11
1
#: users/templates/users/user_list.html:1
15
#: users/templates/users/user_list.html:11
7
#: users/templates/users/user_list.html:1
21
#: 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/cloud/templates/cloud/account_detail.html:27
...
...
@@ -719,7 +719,7 @@ msgstr "SSH网关,支持代理SSH,RDP和VNC"
#: ops/models/adhoc.py:189 perms/templates/perms/asset_permission_list.html:205
#: perms/templates/perms/remote_app_permission_user.html:50
#: settings/templates/settings/_ldap_list_users_modal.html:31 users/forms.py:14
#: users/forms.py:161 users/models/user.py:4
3
1
#: users/forms.py:161 users/models/user.py:4
4
1
#: users/templates/users/_select_user_modal.html:14
#: users/templates/users/user_detail.html:68
#: users/templates/users/user_list.html:36
...
...
@@ -760,7 +760,7 @@ msgstr "密码"
#: assets/forms/user.py:30 assets/serializers/asset_user.py:71
#: assets/templates/assets/_asset_user_auth_update_modal.html:27
#: users/models/user.py:4
6
0
#: users/models/user.py:4
7
0
msgid "Private key"
msgstr "ssh私钥"
...
...
@@ -975,7 +975,7 @@ msgstr "带宽"
msgid "Contact"
msgstr "联系人"
#: assets/models/cluster.py:22 users/models/user.py:4
5
2
#: assets/models/cluster.py:22 users/models/user.py:4
6
2
#: users/templates/users/user_detail.html:77
msgid "Phone"
msgstr "手机"
...
...
@@ -1001,7 +1001,7 @@ msgid "Default"
msgstr "默认"
#: assets/models/cluster.py:36 assets/models/label.py:14
#: users/models/user.py:5
7
5
#: users/models/user.py:5
8
5
msgid "System"
msgstr "系统"
...
...
@@ -1142,7 +1142,7 @@ msgstr "默认资产组"
#: 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:103 users/forms.py:339
#: users/models/user.py:148 users/models/user.py:164 users/models/user.py:5
6
3
#: users/models/user.py:148 users/models/user.py:164 users/models/user.py:5
7
3
#: users/serializers/group.py:21
#: users/templates/users/user_asset_permission.html:55
#: users/templates/users/user_asset_permission.html:84
...
...
@@ -1303,7 +1303,7 @@ msgid "Backend"
msgstr "后端"
#: assets/serializers/asset_user.py:67 users/forms.py:282
#: users/models/user.py:4
6
3 users/templates/users/first_login.html:42
#: users/models/user.py:4
7
3 users/templates/users/first_login.html:42
#: users/templates/users/user_password_update.html:49
#: users/templates/users/user_profile.html:69
#: users/templates/users/user_profile_update.html:46
...
...
@@ -1727,7 +1727,7 @@ msgstr "选择节点"
#: users/templates/users/user_detail.html:548
#: users/templates/users/user_group_create_update.html:28
#: users/templates/users/user_group_list.html:120
#: users/templates/users/user_list.html:2
5
6
#: users/templates/users/user_list.html:2
7
6
#: xpack/plugins/cloud/templates/cloud/account_create_update.html:34
#: xpack/plugins/cloud/templates/cloud/sync_instance_task_create_update.html:54
#: xpack/plugins/gathered_user/templates/gathered_user/task_create_update.html:45
...
...
@@ -1784,8 +1784,8 @@ msgstr "创建管理用户"
#: assets/templates/assets/system_user_list.html:217
#: users/templates/users/user_group_list.html:164
#: users/templates/users/user_group_list.html:195
#: users/templates/users/user_list.html:1
65
#: users/templates/users/user_list.html:
197
#: users/templates/users/user_list.html:1
84
#: users/templates/users/user_list.html:
216
#: xpack/plugins/vault/templates/vault/vault.html:200
msgid "Please select file"
msgstr "选择文件"
...
...
@@ -1875,12 +1875,12 @@ msgid "Hardware"
msgstr "硬件"
#: assets/templates/assets/asset_list.html:109
#: users/templates/users/user_list.html:5
0
#: users/templates/users/user_list.html:5
1
msgid "Delete selected"
msgstr "批量删除"
#: assets/templates/assets/asset_list.html:110
#: users/templates/users/user_list.html:5
1
#: users/templates/users/user_list.html:5
5
msgid "Update selected"
msgstr "批量更新"
...
...
@@ -1889,12 +1889,12 @@ msgid "Remove from this node"
msgstr "从节点移除"
#: assets/templates/assets/asset_list.html:112
#: users/templates/users/user_list.html:5
2
#: users/templates/users/user_list.html:5
6
msgid "Deactive selected"
msgstr "禁用所选"
#: assets/templates/assets/asset_list.html:113
#: users/templates/users/user_list.html:5
3
#: users/templates/users/user_list.html:5
7
msgid "Active selected"
msgstr "激活所选"
...
...
@@ -1928,7 +1928,7 @@ msgstr "显示所有子节点资产"
#: users/templates/users/user_detail.html:474
#: users/templates/users/user_detail.html:542
#: users/templates/users/user_group_list.html:114
#: users/templates/users/user_list.html:2
5
0
#: users/templates/users/user_list.html:2
7
0
#: xpack/plugins/interface/templates/interface/interface.html:97
msgid "Are you sure?"
msgstr "你确认吗?"
...
...
@@ -1943,7 +1943,7 @@ msgstr "删除选择资产"
#: users/templates/users/user_detail.html:478
#: users/templates/users/user_detail.html:546
#: users/templates/users/user_group_list.html:118
#: users/templates/users/user_list.html:2
5
4
#: users/templates/users/user_list.html:2
7
4
#: xpack/plugins/interface/templates/interface/interface.html:101
msgid "Cancel"
msgstr "取消"
...
...
@@ -2326,7 +2326,7 @@ msgstr "Agent"
#: audits/models.py:86 audits/templates/audits/login_log_list.html:62
#: authentication/templates/authentication/_mfa_confirm_modal.html:14
#: users/forms.py:194 users/models/user.py:4
5
5
#: users/forms.py:194 users/models/user.py:4
6
5
#: users/templates/users/first_login.html:45
msgid "MFA"
msgstr "MFA"
...
...
@@ -2581,14 +2581,14 @@ msgid "Show"
msgstr "显示"
#: authentication/templates/authentication/_access_key_modal.html:66
#: users/models/user.py:3
5
5 users/templates/users/user_profile.html:94
#: users/models/user.py:3
6
5 users/templates/users/user_profile.html:94
#: users/templates/users/user_profile.html:163
#: users/templates/users/user_profile.html:166
msgid "Disable"
msgstr "禁用"
#: authentication/templates/authentication/_access_key_modal.html:67
#: users/models/user.py:3
5
6 users/templates/users/user_profile.html:92
#: users/models/user.py:3
6
6 users/templates/users/user_profile.html:92
#: users/templates/users/user_profile.html:170
msgid "Enable"
msgstr "启用"
...
...
@@ -3235,7 +3235,7 @@ msgstr "提示:RDP 协议不支持单独控制上传或下载文件"
#: perms/templates/perms/asset_permission_list.html:206
#: perms/templates/perms/remote_app_permission_list.html:16
#: templates/_nav.html:21 users/forms.py:313 users/models/group.py:26
#: users/models/user.py:4
3
9 users/templates/users/_select_user_modal.html:16
#: users/models/user.py:4
4
9 users/templates/users/_select_user_modal.html:16
#: users/templates/users/user_asset_permission.html:56
#: users/templates/users/user_asset_permission.html:87
#: users/templates/users/user_detail.html:222
...
...
@@ -3283,7 +3283,7 @@ msgstr "资产授权"
#: perms/models/base.py:53
#: perms/templates/perms/asset_permission_detail.html:85
#: perms/templates/perms/remote_app_permission_detail.html:77
#: users/models/user.py:4
7
1 users/templates/users/user_detail.html:108
#: users/models/user.py:4
8
1 users/templates/users/user_detail.html:108
#: users/templates/users/user_profile.html:120
msgid "Date expired"
msgstr "失效日期"
...
...
@@ -3858,7 +3858,7 @@ msgid "Refresh cache"
msgstr "刷新缓存"
#: settings/templates/settings/_ldap_list_users_modal.html:33
#: users/models/user.py:4
3
5 users/templates/users/user_detail.html:72
#: users/models/user.py:4
4
5 users/templates/users/user_detail.html:72
#: users/templates/users/user_profile.html:59
msgid "Email"
msgstr "邮件"
...
...
@@ -4827,11 +4827,11 @@ msgstr "工单列表"
msgid "Ticket detail"
msgstr "工单详情"
#: users/api/user.py:1
74
#: users/api/user.py:1
80
msgid "Could not reset self otp, use profile reset instead"
msgstr "不能再该页面重置MFA, 请去个人信息页面重置"
#: users/forms.py:47 users/models/user.py:4
4
3
#: users/forms.py:47 users/models/user.py:4
5
3
#: users/templates/users/_select_user_modal.html:15
#: users/templates/users/user_detail.html:88
#: users/templates/users/user_list.html:37
...
...
@@ -4839,7 +4839,7 @@ msgstr "不能再该页面重置MFA, 请去个人信息页面重置"
msgid "Role"
msgstr "角色"
#: users/forms.py:51 users/models/user.py:4
7
8
#: users/forms.py:51 users/models/user.py:4
8
8
#: users/templates/users/user_detail.html:104
#: users/templates/users/user_list.html:39
#: users/templates/users/user_profile.html:102
...
...
@@ -4957,7 +4957,7 @@ msgstr "选择用户"
msgid "User auth from {}, go there change password"
msgstr "用户认证源来自 {}, 请去相应系统修改密码"
#: users/models/user.py:147 users/models/user.py:5
7
1
#: users/models/user.py:147 users/models/user.py:5
8
1
msgid "Administrator"
msgstr "管理员"
...
...
@@ -4978,27 +4978,27 @@ msgstr "组织管理员"
msgid "Org auditor"
msgstr "组织审计员"
#: users/models/user.py:3
5
7 users/templates/users/user_profile.html:90
#: users/models/user.py:3
6
7 users/templates/users/user_profile.html:90
msgid "Force enable"
msgstr "强制启用"
#: users/models/user.py:4
2
3
#: users/models/user.py:4
3
3
msgid "Local"
msgstr "数据库"
#: users/models/user.py:4
4
6
#: users/models/user.py:4
5
6
msgid "Avatar"
msgstr "头像"
#: users/models/user.py:4
4
9 users/templates/users/user_detail.html:83
#: users/models/user.py:4
5
9 users/templates/users/user_detail.html:83
msgid "Wechat"
msgstr "微信"
#: users/models/user.py:4
8
2
#: users/models/user.py:4
9
2
msgid "Date password last updated"
msgstr "最后更新密码日期"
#: users/models/user.py:5
7
4
#: users/models/user.py:5
8
4
msgid "Administrator is the super user of system"
msgstr "Administrator是初始的超级管理员"
...
...
@@ -5372,28 +5372,52 @@ msgstr "用户组删除"
msgid "UserGroup Deleting failed."
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 !!!"
msgstr "删除选中用户 !!!"
#: users/templates/users/user_list.html:2
6
2
msgid "User Deleted."
msgstr "
已被删除
"
#: users/templates/users/user_list.html:2
8
2
msgid "User Delet
ing fail
ed."
msgstr "
用户删除失败
"
#: users/templates/users/user_list.html:263
#: users/templates/users/user_list.html:267
#: users/templates/users/user_list.html:283
msgid "User Delete"
msgstr "删除"
#: users/templates/users/user_list.html:266
msgid "User Deleting failed."
msgstr "用户删除失败"
#: users/templates/users/user_list.html:305
msgid "This will remove the selected users !!"
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"
msgstr "用户已失效"
#: users/templates/users/user_list.html:3
30
#: users/templates/users/user_list.html:3
66
msgid "User is inactive"
msgstr "用户已禁用"
...
...
@@ -6503,6 +6527,9 @@ msgstr "密码匣子"
msgid "vault create"
msgstr "创建"
#~ msgid "User Deleted."
#~ msgstr "已被删除"
#~ msgid "Search no entry matched in ou {}"
#~ msgstr "在ou:{}中没有匹配条目"
...
...
@@ -6556,9 +6583,6 @@ msgstr "创建"
#~ msgid "Delete failed"
#~ msgstr "删除失败"
#~ msgid "Are you sure about deleting it?"
#~ msgstr "您确定删除吗?"
#~ msgid "The connection fails"
#~ msgstr "连接失败"
...
...
@@ -6588,9 +6612,6 @@ msgstr "创建"
#~ msgid "Approve selected"
#~ msgstr "同意所选"
#~ msgid "Reject selected"
#~ msgstr "拒绝所选"
#~ msgid ""
#~ "\n"
#~ " <div>\n"
...
...
apps/static/js/jumpserver.js
浏览文件 @
16864ca3
...
...
@@ -316,7 +316,7 @@ function requestApi(props) {
}
// Sweet Alert for Delete
function
objectDelete
(
obj
,
name
,
url
,
redirectTo
)
{
function
objectDelete
(
obj
,
name
,
url
,
redirectTo
,
title
,
success_message
)
{
function
doDelete
()
{
var
body
=
{};
var
success
=
function
()
{
...
...
@@ -335,14 +335,14 @@ function objectDelete(obj, name, url, redirectTo) {
url
:
url
,
body
:
JSON
.
stringify
(
body
),
method
:
'
DELETE
'
,
success_message
:
gettext
(
"
Delete the success
"
),
success_message
:
success_message
||
gettext
(
"
Delete the success
"
),
success
:
success
,
error
:
fail
});
}
swal
({
title
:
gettext
(
'
Are you sure about deleting it?
'
),
title
:
title
||
gettext
(
'
Are you sure about deleting it?
'
),
text
:
"
[
"
+
name
+
"
]
"
,
type
:
"
warning
"
,
showCancelButton
:
true
,
...
...
apps/templates/_foot_js.html
浏览文件 @
16864ca3
...
...
@@ -7,7 +7,7 @@
<script
src=
"{% static "
js
/
plugins
/
toastr
/
toastr.min.js
"
%}"
></script>
<script
src=
"{% static "
js
/
inspinia.js
"
%}"
></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/i18n/zh-CN.js' %}"
></script>
<script>
...
...
apps/users/api/user.py
浏览文件 @
16864ca3
...
...
@@ -67,6 +67,12 @@ class UserViewSet(CommonApiMixin, UserQuerysetMixin, BulkModelViewSet):
self
.
permission_classes
=
(
IsSuperUser
,)
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
):
for
obj
in
objects
:
self
.
check_object_permissions
(
self
.
request
,
obj
)
...
...
apps/users/models/user.py
浏览文件 @
16864ca3
...
...
@@ -267,6 +267,16 @@ class RoleMixin:
access_key
=
app
.
create_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
:
CACHE_KEY_USER_RESET_PASSWORD_PREFIX
=
"_KEY_USER_RESET_PASSWORD_{}"
...
...
apps/users/templates/users/user_list.html
浏览文件 @
16864ca3
...
...
@@ -47,7 +47,11 @@
<div
id=
"actions"
class=
"hide"
>
<div
class=
"input-group"
>
<select
class=
"form-control m-b"
style=
"width: auto"
id=
"slct_bulk_update"
>
{% 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=
"deactive"
>
{% trans 'Deactive selected' %}
</option>
<option
value=
"active"
>
{% trans 'Active selected' %}
</option>
...
...
@@ -107,16 +111,31 @@ function initTable() {
}
var
del_btn
=
""
;
var
rm_btn
=
""
;
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
(
'
99991938
'
,
name
);
}
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
(
'
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
)
}
}}],
ajax_url
:
'
{% url "api-users:user-list" %}
'
,
columns
:
[
...
...
@@ -245,10 +264,11 @@ $(document).ready(function(){
success
:
reloadPage
});
}
function
doDelete
()
{
function
doDelete
(
props
)
{
props
=
props
||
{};
swal
({
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
"
,
showCancelButton
:
true
,
cancelButtonText
:
"
{% trans 'Cancel' %}
"
,
...
...
@@ -258,10 +278,6 @@ $(document).ready(function(){
},
function
()
{
function
success
(
data
)
{
url
=
setUrlParam
(
the_url
,
'
spm
'
,
data
.
spm
);
function
success
()
{
var
msg
=
"
{% trans 'User Deleted.' %}
"
;
swal
(
"
{% trans 'User Delete' %}
"
,
msg
,
"
success
"
);
}
function
fail
()
{
var
msg
=
"
{% trans 'User Deleting failed.' %}
"
;
swal
(
"
{% trans 'User Delete' %}
"
,
msg
,
"
error
"
);
...
...
@@ -271,7 +287,7 @@ $(document).ready(function(){
method
:
'
DELETE
'
,
flash_message
:
true
,
success
:
reloadPage
,
error
:
fail
error
:
props
.
fail
||
fail
});
}
requestApi
({
...
...
@@ -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
fail
(
data
)
{
toastr
.
error
(
JSON
.
parse
(
data
))
...
...
@@ -308,6 +335,9 @@ $(document).ready(function(){
case
'
delete
'
:
doDelete
();
break
;
case
'
remove
'
:
doRemove
();
break
;
case
'
update
'
:
doUpdate
();
break
;
...
...
@@ -321,8 +351,14 @@ $(document).ready(function(){
var
$this
=
$
(
this
);
var
name
=
$this
.
data
(
'
name
'
);
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
);
objectDelete
(
$this
,
name
,
the_url
);
objectDelete
(
$this
,
name
,
the_url
,
null
,
title
,
success_message
);
}).
on
(
'
click
'
,
'
.expired
'
,
function
()
{
var
msg
=
'
{% trans "User is expired" %}
'
;
toastr
.
error
(
msg
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录