Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
82b9c251
Commit
82b9c251
authored
Nov 20, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
[Update] Merge it
parents
66b8e59a
d563a11a
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
78 additions
and
64 deletions
+78
-64
domain.py
apps/assets/api/domain.py
+1
-1
base.py
apps/assets/backends/base.py
+7
-5
domain.py
apps/assets/models/domain.py
+4
-1
domain_gateway_list.html
apps/assets/templates/assets/domain_gateway_list.html
+1
-1
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+47
-48
terminal.py
apps/terminal/api_v2/terminal.py
+7
-0
terminal.py
apps/terminal/serializers_v2/terminal.py
+0
-3
jms
jms
+11
-5
No files found.
apps/assets/api/domain.py
View file @
82b9c251
...
@@ -44,4 +44,4 @@ class GatewayTestConnectionApi(SingleObjectMixin, APIView):
...
@@ -44,4 +44,4 @@ class GatewayTestConnectionApi(SingleObjectMixin, APIView):
if
ok
:
if
ok
:
return
Response
(
"ok"
)
return
Response
(
"ok"
)
else
:
else
:
return
Response
({
"
failed"
:
e
},
status
=
404
)
return
Response
({
"
error"
:
e
},
status
=
400
)
apps/assets/backends/base.py
View file @
82b9c251
...
@@ -38,6 +38,9 @@ class AssetUserQuerySet(list):
...
@@ -38,6 +38,9 @@ class AssetUserQuerySet(list):
if
len
(
v
)
==
0
:
if
len
(
v
)
==
0
:
return
self
return
self
if
k
.
find
(
"__in"
)
>=
0
:
if
k
.
find
(
"__in"
)
>=
0
:
_k
=
k
.
split
(
'__'
)[
0
]
in_kwargs
[
_k
]
=
v
else
:
in_kwargs
[
k
]
=
v
in_kwargs
[
k
]
=
v
for
k
in
in_kwargs
:
for
k
in
in_kwargs
:
kwargs
.
pop
(
k
)
kwargs
.
pop
(
k
)
...
@@ -45,17 +48,16 @@ class AssetUserQuerySet(list):
...
@@ -45,17 +48,16 @@ class AssetUserQuerySet(list):
if
len
(
in_kwargs
)
==
0
:
if
len
(
in_kwargs
)
==
0
:
return
self
return
self
for
i
in
self
:
for
i
in
self
:
matched
=
Tru
e
matched
=
Fals
e
for
k
,
v
in
in_kwargs
.
items
():
for
k
,
v
in
in_kwargs
.
items
():
key
=
k
.
split
(
'__'
)[
0
]
attr
=
getattr
(
i
,
k
,
None
)
attr
=
getattr
(
i
,
key
,
None
)
# 如果属性或者value中是uuid,则转换成string
# 如果属性或者value中是uuid,则转换成string
if
isinstance
(
v
[
0
],
uuid
.
UUID
):
if
isinstance
(
v
[
0
],
uuid
.
UUID
):
v
=
[
str
(
i
)
for
i
in
v
]
v
=
[
str
(
i
)
for
i
in
v
]
if
isinstance
(
attr
,
uuid
.
UUID
):
if
isinstance
(
attr
,
uuid
.
UUID
):
attr
=
str
(
attr
)
attr
=
str
(
attr
)
if
attr
not
in
v
:
if
v
in
attr
:
matched
=
Fals
e
matched
=
Tru
e
if
matched
:
if
matched
:
queryset
.
append
(
i
)
queryset
.
append
(
i
)
return
AssetUserQuerySet
(
queryset
)
return
AssetUserQuerySet
(
queryset
)
...
...
apps/assets/models/domain.py
View file @
82b9c251
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
import
uuid
import
uuid
import
random
import
random
import
re
import
paramiko
import
paramiko
from
django.db
import
models
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
...
@@ -63,6 +63,9 @@ class Gateway(AssetUser):
...
@@ -63,6 +63,9 @@ class Gateway(AssetUser):
def
test_connective
(
self
,
local_port
=
None
):
def
test_connective
(
self
,
local_port
=
None
):
if
local_port
is
None
:
if
local_port
is
None
:
local_port
=
self
.
port
local_port
=
self
.
port
if
not
re
.
match
(
r'\w+$'
,
self
.
password
):
return
False
,
_
(
"Password should not contain special characters"
)
client
=
paramiko
.
SSHClient
()
client
=
paramiko
.
SSHClient
()
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
proxy
=
paramiko
.
SSHClient
()
proxy
=
paramiko
.
SSHClient
()
...
...
apps/assets/templates/assets/domain_gateway_list.html
View file @
82b9c251
...
@@ -139,7 +139,7 @@ $(document).ready(function(){
...
@@ -139,7 +139,7 @@ $(document).ready(function(){
method
:
"POST"
,
method
:
"POST"
,
body
:
JSON
.
stringify
({
'port'
:
parseInt
(
data
.
port
)}),
body
:
JSON
.
stringify
({
'port'
:
parseInt
(
data
.
port
)}),
success_message
:
"{% trans 'Can be connected' %}"
,
success_message
:
"{% trans 'Can be connected' %}"
,
fail_message
:
"{% trans 'The connection fails' %}"
{
#
fail_message
:
"{% trans 'The connection fails' %}"
#
}
})
})
});
});
</script>
</script>
...
...
apps/locale/zh/LC_MESSAGES/django.mo
View file @
82b9c251
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
82b9c251
...
@@ -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-11-
19 10:29
+0800\n"
"POT-Creation-Date: 2019-11-
20 12:02
+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"
...
@@ -144,7 +144,7 @@ msgstr "资产"
...
@@ -144,7 +144,7 @@ msgstr "资产"
#: settings/templates/settings/terminal_setting.html:105 terminal/models.py:23
#: settings/templates/settings/terminal_setting.html:105 terminal/models.py:23
#: terminal/models.py:260 terminal/templates/terminal/terminal_detail.html:43
#: terminal/models.py:260 terminal/templates/terminal/terminal_detail.html:43
#: terminal/templates/terminal/terminal_list.html:29 users/forms.py:162
#: terminal/templates/terminal/terminal_list.html:29 users/forms.py:162
#: users/models/group.py:14 users/models/user.py:42
8
#: users/models/group.py:14 users/models/user.py:42
9
#: users/templates/users/_select_user_modal.html:13
#: users/templates/users/_select_user_modal.html:13
#: users/templates/users/user_detail.html:63
#: users/templates/users/user_detail.html:63
#: users/templates/users/user_group_detail.html:55
#: users/templates/users/user_group_detail.html:55
...
@@ -198,7 +198,7 @@ msgstr "参数"
...
@@ -198,7 +198,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:98
#: perms/templates/perms/asset_permission_detail.html:98
#: perms/templates/perms/remote_app_permission_detail.html:90
#: perms/templates/perms/remote_app_permission_detail.html:90
#: users/models/user.py:4
69
users/serializers/group.py:32
#: users/models/user.py:4
70
users/serializers/group.py:32
#: users/templates/users/user_detail.html:111
#: users/templates/users/user_detail.html:111
#: 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
...
@@ -261,7 +261,7 @@ msgstr "创建日期"
...
@@ -261,7 +261,7 @@ msgstr "创建日期"
#: settings/models.py:34 terminal/models.py:33
#: settings/models.py:34 terminal/models.py:33
#: 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:46
1
users/templates/users/user_detail.html:129
#: users/models/user.py:46
2
users/templates/users/user_detail.html:129
#: users/templates/users/user_group_detail.html:67
#: users/templates/users/user_group_detail.html:67
#: 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
...
@@ -683,7 +683,7 @@ msgstr "选择资产"
...
@@ -683,7 +683,7 @@ msgstr "选择资产"
msgid "Content should not be contain: {}"
msgid "Content should not be contain: {}"
msgstr "内容不能包含: {}"
msgstr "内容不能包含: {}"
#: assets/forms/domain.py:55
#: assets/forms/domain.py:55
assets/models/domain.py:67
msgid "Password should not contain special characters"
msgid "Password should not contain special characters"
msgstr "不能包含特殊字符"
msgstr "不能包含特殊字符"
...
@@ -708,7 +708,7 @@ msgstr "SSH网关,支持代理SSH,RDP和VNC"
...
@@ -708,7 +708,7 @@ msgstr "SSH网关,支持代理SSH,RDP和VNC"
#: perms/templates/perms/asset_permission_user.html:55
#: perms/templates/perms/asset_permission_user.html:55
#: perms/templates/perms/remote_app_permission_user.html:54
#: perms/templates/perms/remote_app_permission_user.html:54
#: 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:42
6
#: users/forms.py:161 users/models/user.py:42
7
#: users/templates/users/_select_user_modal.html:14
#: users/templates/users/_select_user_modal.html:14
#: users/templates/users/user_detail.html:67
#: users/templates/users/user_detail.html:67
#: users/templates/users/user_list.html:36
#: users/templates/users/user_list.html:36
...
@@ -749,7 +749,7 @@ msgstr "密码"
...
@@ -749,7 +749,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:45
5
#: users/models/user.py:45
6
msgid "Private key"
msgid "Private key"
msgstr "ssh私钥"
msgstr "ssh私钥"
...
@@ -964,7 +964,7 @@ msgstr "带宽"
...
@@ -964,7 +964,7 @@ msgstr "带宽"
msgid "Contact"
msgid "Contact"
msgstr "联系人"
msgstr "联系人"
#: assets/models/cluster.py:22 users/models/user.py:44
7
#: assets/models/cluster.py:22 users/models/user.py:44
8
#: users/templates/users/user_detail.html:76
#: users/templates/users/user_detail.html:76
msgid "Phone"
msgid "Phone"
msgstr "手机"
msgstr "手机"
...
@@ -990,7 +990,7 @@ msgid "Default"
...
@@ -990,7 +990,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:56
7
#: users/models/user.py:56
8
msgid "System"
msgid "System"
msgstr "系统"
msgstr "系统"
...
@@ -1133,7 +1133,7 @@ msgstr "默认资产组"
...
@@ -1133,7 +1133,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:100 users/forms.py:339
#: tickets/templates/tickets/ticket_list.html:100 users/forms.py:339
#: users/models/user.py:148 users/models/user.py:164 users/models/user.py:55
5
#: users/models/user.py:148 users/models/user.py:164 users/models/user.py:55
6
#: users/serializers/group.py:21
#: users/serializers/group.py:21
#: users/templates/users/user_group_detail.html:78
#: users/templates/users/user_group_detail.html:78
#: users/templates/users/user_group_list.html:36 users/views/user.py:250
#: users/templates/users/user_group_list.html:36 users/views/user.py:250
...
@@ -1289,7 +1289,7 @@ msgid "Backend"
...
@@ -1289,7 +1289,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:45
8
users/templates/users/first_login.html:42
#: users/models/user.py:45
9
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
...
@@ -2012,10 +2012,6 @@ msgstr "测试连接"
...
@@ -2012,10 +2012,6 @@ msgstr "测试连接"
msgid "Can be connected"
msgid "Can be connected"
msgstr "可连接"
msgstr "可连接"
#: assets/templates/assets/domain_gateway_list.html:142
msgid "The connection fails"
msgstr "连接失败"
#: assets/templates/assets/domain_list.html:6
#: assets/templates/assets/domain_list.html:6
msgid ""
msgid ""
"The domain function is added to address the fact that some environments "
"The domain function is added to address the fact that some environments "
...
@@ -2293,7 +2289,7 @@ msgstr "Agent"
...
@@ -2293,7 +2289,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:45
0
#: users/forms.py:194 users/models/user.py:45
1
#: users/templates/users/first_login.html:45
#: users/templates/users/first_login.html:45
msgid "MFA"
msgid "MFA"
msgstr "MFA"
msgstr "MFA"
...
@@ -2807,7 +2803,7 @@ msgstr ""
...
@@ -2807,7 +2803,7 @@ msgstr ""
#: jumpserver/views.py:233
#: jumpserver/views.py:233
msgid "Websocket server run on port: {}, you should proxy it on nginx"
msgid "Websocket server run on port: {}, you should proxy it on nginx"
msgstr ""
msgstr "
Websocket 服务运行在端口: {}, 请检查nginx是否代理是否设置
"
#: jumpserver/views.py:241
#: jumpserver/views.py:241
msgid ""
msgid ""
...
@@ -3198,7 +3194,7 @@ msgstr "提示:RDP 协议不支持单独控制上传或下载文件"
...
@@ -3198,7 +3194,7 @@ msgstr "提示:RDP 协议不支持单独控制上传或下载文件"
#: perms/templates/perms/asset_permission_list.html:211
#: perms/templates/perms/asset_permission_list.html:211
#: 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:43
4
users/templates/users/_select_user_modal.html:16
#: users/models/user.py:43
5
users/templates/users/_select_user_modal.html:16
#: users/templates/users/user_detail.html:219
#: users/templates/users/user_detail.html:219
#: users/templates/users/user_list.html:38
#: users/templates/users/user_list.html:38
#: xpack/plugins/orgs/templates/orgs/org_list.html:16
#: xpack/plugins/orgs/templates/orgs/org_list.html:16
...
@@ -3241,7 +3237,7 @@ msgstr "资产授权"
...
@@ -3241,7 +3237,7 @@ msgstr "资产授权"
#: perms/models/base.py:53
#: perms/models/base.py:53
#: perms/templates/perms/asset_permission_detail.html:90
#: perms/templates/perms/asset_permission_detail.html:90
#: perms/templates/perms/remote_app_permission_detail.html:82
#: perms/templates/perms/remote_app_permission_detail.html:82
#: users/models/user.py:46
6
users/templates/users/user_detail.html:107
#: users/models/user.py:46
7
users/templates/users/user_detail.html:107
#: users/templates/users/user_profile.html:120
#: users/templates/users/user_profile.html:120
msgid "Date expired"
msgid "Date expired"
msgstr "失效日期"
msgstr "失效日期"
...
@@ -3816,7 +3812,7 @@ msgid "Refresh cache"
...
@@ -3816,7 +3812,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:43
0
users/templates/users/user_detail.html:71
#: users/models/user.py:43
1
users/templates/users/user_detail.html:71
#: users/templates/users/user_profile.html:59
#: users/templates/users/user_profile.html:59
msgid "Email"
msgid "Email"
msgstr "邮件"
msgstr "邮件"
...
@@ -4757,11 +4753,11 @@ msgstr "工单列表"
...
@@ -4757,11 +4753,11 @@ msgstr "工单列表"
msgid "Ticket detail"
msgid "Ticket detail"
msgstr "工单详情"
msgstr "工单详情"
#: users/api/user.py:17
3
#: users/api/user.py:17
4
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:43
8
#: users/forms.py:47 users/models/user.py:43
9
#: users/templates/users/_select_user_modal.html:15
#: users/templates/users/_select_user_modal.html:15
#: users/templates/users/user_detail.html:87
#: users/templates/users/user_detail.html:87
#: users/templates/users/user_list.html:37
#: users/templates/users/user_list.html:37
...
@@ -4769,7 +4765,7 @@ msgstr "不能再该页面重置MFA, 请去个人信息页面重置"
...
@@ -4769,7 +4765,7 @@ msgstr "不能再该页面重置MFA, 请去个人信息页面重置"
msgid "Role"
msgid "Role"
msgstr "角色"
msgstr "角色"
#: users/forms.py:51 users/models/user.py:47
3
#: users/forms.py:51 users/models/user.py:47
4
#: users/templates/users/user_detail.html:103
#: users/templates/users/user_detail.html:103
#: 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
...
@@ -4797,7 +4793,7 @@ msgstr "添加到用户组"
...
@@ -4797,7 +4793,7 @@ msgstr "添加到用户组"
msgid "Public key should not be the same as your old one."
msgid "Public key should not be the same as your old one."
msgstr "不能和原来的密钥相同"
msgstr "不能和原来的密钥相同"
#: users/forms.py:110 users/forms.py:271 users/serializers/user.py:1
09
#: users/forms.py:110 users/forms.py:271 users/serializers/user.py:1
22
msgid "Not a valid ssh public key"
msgid "Not a valid ssh public key"
msgstr "ssh密钥不合法"
msgstr "ssh密钥不合法"
...
@@ -4887,7 +4883,7 @@ msgstr "选择用户"
...
@@ -4887,7 +4883,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:56
3
#: users/models/user.py:147 users/models/user.py:56
4
msgid "Administrator"
msgid "Administrator"
msgstr "管理员"
msgstr "管理员"
...
@@ -4912,23 +4908,23 @@ msgstr "组织审计员"
...
@@ -4912,23 +4908,23 @@ msgstr "组织审计员"
msgid "Force enable"
msgid "Force enable"
msgstr "强制启用"
msgstr "强制启用"
#: users/models/user.py:41
8
#: users/models/user.py:41
9
msgid "Local"
msgid "Local"
msgstr "数据库"
msgstr "数据库"
#: users/models/user.py:44
1
#: users/models/user.py:44
2
msgid "Avatar"
msgid "Avatar"
msgstr "头像"
msgstr "头像"
#: users/models/user.py:44
4
users/templates/users/user_detail.html:82
#: users/models/user.py:44
5
users/templates/users/user_detail.html:82
msgid "Wechat"
msgid "Wechat"
msgstr "微信"
msgstr "微信"
#: users/models/user.py:47
7
#: users/models/user.py:47
8
msgid "Date password last updated"
msgid "Date password last updated"
msgstr "最后更新密码日期"
msgstr "最后更新密码日期"
#: users/models/user.py:56
6
#: users/models/user.py:56
7
msgid "Administrator is the super user of system"
msgid "Administrator is the super user of system"
msgstr "Administrator是初始的超级管理员"
msgstr "Administrator是初始的超级管理员"
...
@@ -4936,42 +4932,42 @@ msgstr "Administrator是初始的超级管理员"
...
@@ -4936,42 +4932,42 @@ msgstr "Administrator是初始的超级管理员"
msgid "Auditors cannot be join in the user group"
msgid "Auditors cannot be join in the user group"
msgstr "审计员不能被加入到用户组"
msgstr "审计员不能被加入到用户组"
#: users/serializers/user.py:39
#: users/serializers/user.py:35
msgid "Groups name"
msgstr "用户组名"
#: users/serializers/user.py:40
msgid "Source name"
msgstr "用户来源名"
#: users/serializers/user.py:41
msgid "Is first login"
msgid "Is first login"
msgstr "首次登录"
msgstr "首次登录"
#: users/serializers/user.py:42
#: users/serializers/user.py:36
msgid "Role name"
msgstr "角色名"
#: users/serializers/user.py:43
msgid "Is valid"
msgid "Is valid"
msgstr "账户是否有效"
msgstr "账户是否有效"
#: users/serializers/user.py:
44
#: users/serializers/user.py:
37
msgid "Is expired"
msgid "Is expired"
msgstr " 是否过期"
msgstr " 是否过期"
#: users/serializers/user.py:
45
#: users/serializers/user.py:
38
msgid "Avatar url"
msgid "Avatar url"
msgstr "头像路径"
msgstr "头像路径"
#: users/serializers/user.py:
65
#: users/serializers/user.py:
46
msgid "Role limit to {}"
msgid "Role limit to {}"
msgstr "角色只能为 {}"
msgstr "角色只能为 {}"
#: users/serializers/user.py:
77
#: users/serializers/user.py:
58
msgid "Password does not match security rules"
msgid "Password does not match security rules"
msgstr "密码不满足安全规则"
msgstr "密码不满足安全规则"
#: users/serializers/user.py:107
msgid "Groups name"
msgstr "用户组名"
#: users/serializers/user.py:108
msgid "Source name"
msgstr "用户来源名"
#: users/serializers/user.py:109
msgid "Role name"
msgstr "角色名"
#: users/serializers_v2/user.py:36
#: users/serializers_v2/user.py:36
msgid "name not unique"
msgid "name not unique"
msgstr "名称重复"
msgstr "名称重复"
...
@@ -6431,6 +6427,9 @@ msgstr "密码匣子"
...
@@ -6431,6 +6427,9 @@ msgstr "密码匣子"
msgid "vault create"
msgid "vault create"
msgstr "创建"
msgstr "创建"
#~ msgid "The connection fails"
#~ msgstr "连接失败"
#~ msgid "Assigned ticket"
#~ msgid "Assigned ticket"
#~ msgstr "处理人"
#~ msgstr "处理人"
...
...
apps/terminal/api_v2/terminal.py
View file @
82b9c251
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
from
rest_framework
import
viewsets
,
generics
from
rest_framework
import
viewsets
,
generics
from
rest_framework
import
status
from
rest_framework
import
status
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
from
django.conf
import
settings
from
common.permissions
import
IsSuperUser
,
WithBootstrapToken
from
common.permissions
import
IsSuperUser
,
WithBootstrapToken
...
@@ -17,6 +18,9 @@ class TerminalViewSet(viewsets.ModelViewSet):
...
@@ -17,6 +18,9 @@ class TerminalViewSet(viewsets.ModelViewSet):
queryset
=
Terminal
.
objects
.
filter
(
is_deleted
=
False
)
queryset
=
Terminal
.
objects
.
filter
(
is_deleted
=
False
)
serializer_class
=
serializers
.
TerminalSerializer
serializer_class
=
serializers
.
TerminalSerializer
permission_classes
=
[
IsSuperUser
]
permission_classes
=
[
IsSuperUser
]
http_method_names
=
[
'get'
,
'put'
,
'patch'
,
'delete'
,
'head'
,
'options'
,
'trace'
]
class
TerminalRegistrationApi
(
generics
.
CreateAPIView
):
class
TerminalRegistrationApi
(
generics
.
CreateAPIView
):
...
@@ -29,6 +33,9 @@ class TerminalRegistrationApi(generics.CreateAPIView):
...
@@ -29,6 +33,9 @@ class TerminalRegistrationApi(generics.CreateAPIView):
serializer
=
serializers
.
TerminalSerializer
(
serializer
=
serializers
.
TerminalSerializer
(
data
=
data
,
context
=
{
'request'
:
request
}
data
=
data
,
context
=
{
'request'
:
request
}
)
)
if
not
settings
.
SECURITY_SERVICE_ACCOUNT_REGISTRATION
:
data
=
{
"error"
:
"service account registration disabled"
}
return
Response
(
data
=
data
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
serializer
.
is_valid
(
raise_exception
=
True
)
serializer
.
is_valid
(
raise_exception
=
True
)
terminal
=
serializer
.
save
()
terminal
=
serializer
.
save
()
sa_serializer
=
serializer
.
sa_serializer_class
(
instance
=
terminal
.
user
)
sa_serializer
=
serializer
.
sa_serializer_class
(
instance
=
terminal
.
user
)
...
...
apps/terminal/serializers_v2/terminal.py
View file @
82b9c251
...
@@ -28,9 +28,6 @@ class TerminalSerializer(serializers.ModelSerializer):
...
@@ -28,9 +28,6 @@ class TerminalSerializer(serializers.ModelSerializer):
valid
=
super
()
.
is_valid
(
raise_exception
=
raise_exception
)
valid
=
super
()
.
is_valid
(
raise_exception
=
raise_exception
)
if
not
valid
:
if
not
valid
:
return
valid
return
valid
if
not
settings
.
SECURITY_SERVICE_ACCOUNT_REGISTRATION
:
error
=
{
"error"
:
"service account registration disabled"
}
raise
serializers
.
ValidationError
(
error
)
data
=
{
'name'
:
self
.
validated_data
.
get
(
'name'
)}
data
=
{
'name'
:
self
.
validated_data
.
get
(
'name'
)}
kwargs
=
{
'data'
:
data
}
kwargs
=
{
'data'
:
data
}
if
self
.
instance
and
self
.
instance
.
user
:
if
self
.
instance
and
self
.
instance
.
user
:
...
...
jms
View file @
82b9c251
...
@@ -114,7 +114,7 @@ def check_pid(pid):
...
@@ -114,7 +114,7 @@ def check_pid(pid):
""" Check For the existence of a unix pid. """
""" Check For the existence of a unix pid. """
try
:
try
:
os
.
kill
(
pid
,
0
)
os
.
kill
(
pid
,
0
)
except
OSError
:
except
(
OSError
,
ProcessLookupError
)
:
return
False
return
False
else
:
else
:
return
True
return
True
...
@@ -231,6 +231,9 @@ def get_start_worker_kwargs(queue, num):
...
@@ -231,6 +231,9 @@ def get_start_worker_kwargs(queue, num):
if
os
.
getuid
()
==
0
:
if
os
.
getuid
()
==
0
:
os
.
environ
.
setdefault
(
'C_FORCE_ROOT'
,
'1'
)
os
.
environ
.
setdefault
(
'C_FORCE_ROOT'
,
'1'
)
server_hostname
=
os
.
environ
.
get
(
"SERVER_HOSTNAME"
)
if
not
server_hostname
:
server_hostname
=
'
%
h'
cmd
=
[
cmd
=
[
'celery'
,
'worker'
,
'celery'
,
'worker'
,
...
@@ -238,7 +241,7 @@ def get_start_worker_kwargs(queue, num):
...
@@ -238,7 +241,7 @@ def get_start_worker_kwargs(queue, num):
'-l'
,
'INFO'
,
'-l'
,
'INFO'
,
'-c'
,
str
(
num
),
'-c'
,
str
(
num
),
'-Q'
,
queue
,
'-Q'
,
queue
,
'-n'
,
'{}@
%
h'
.
format
(
queu
e
)
'-n'
,
'{}@
{}'
.
format
(
queue
,
server_hostnam
e
)
]
]
return
{
"cmd"
:
cmd
,
"cwd"
:
APPS_DIR
}
return
{
"cmd"
:
cmd
,
"cwd"
:
APPS_DIR
}
...
@@ -437,6 +440,12 @@ def stop_service(srv, sig=15):
...
@@ -437,6 +440,12 @@ def stop_service(srv, sig=15):
print
(
"Stop service: {}"
.
format
(
s
),
end
=
''
)
print
(
"Stop service: {}"
.
format
(
s
),
end
=
''
)
pid
=
get_pid
(
s
)
pid
=
get_pid
(
s
)
os
.
kill
(
pid
,
sig
)
os
.
kill
(
pid
,
sig
)
with
LOCK
:
process
=
processes
.
pop
(
s
,
None
)
if
process
is
None
:
print
(
"
\033
[31m No process found
\033
[0m"
)
continue
process
.
wait
(
1
)
for
i
in
range
(
STOP_TIMEOUT
):
for
i
in
range
(
STOP_TIMEOUT
):
if
i
==
STOP_TIMEOUT
-
1
:
if
i
==
STOP_TIMEOUT
-
1
:
print
(
"
\033
[31m Error
\033
[0m"
)
print
(
"
\033
[31m Error
\033
[0m"
)
...
@@ -447,9 +456,6 @@ def stop_service(srv, sig=15):
...
@@ -447,9 +456,6 @@ def stop_service(srv, sig=15):
time
.
sleep
(
1
)
time
.
sleep
(
1
)
continue
continue
with
LOCK
:
processes
.
pop
(
s
,
None
)
if
srv
==
"all"
:
if
srv
==
"all"
:
stop_daemon_service
()
stop_daemon_service
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment