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
e59b95e9
Commit
e59b95e9
authored
Aug 13, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'github/dev' into dev
parents
3f049440
bb639415
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
179 additions
and
189 deletions
+179
-189
node.py
apps/assets/api/node.py
+14
-6
node.py
apps/assets/models/node.py
+5
-0
asset.py
apps/assets/serializers/asset.py
+1
-1
node.py
apps/assets/serializers/node.py
+1
-1
asset_list.html
apps/assets/templates/assets/asset_list.html
+6
-3
asset.py
apps/assets/views/asset.py
+6
-3
django.mo
apps/i18n/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/i18n/zh/LC_MESSAGES/django.po
+141
-168
settings.py
apps/jumpserver/settings.py
+1
-0
api.py
apps/perms/api.py
+0
-1
utils.py
apps/perms/utils.py
+0
-2
api.py
apps/terminal/api.py
+0
-1
serializers.py
apps/users/serializers.py
+2
-1
requirements.txt
requirements/requirements.txt
+2
-2
No files found.
apps/assets/api/node.py
View file @
e59b95e9
...
...
@@ -43,15 +43,23 @@ class NodeViewSet(viewsets.ModelViewSet):
permission_classes
=
(
IsOrgAdmin
,)
serializer_class
=
serializers
.
NodeSerializer
def
get_queryset
(
self
):
queryset
=
super
()
.
get_queryset
()
.
annotate
(
Count
(
'assets'
))
return
queryset
def
perform_create
(
self
,
serializer
):
child_key
=
Node
.
root
()
.
get_next_child_key
()
serializer
.
validated_data
[
"key"
]
=
child_key
serializer
.
save
()
def
update
(
self
,
request
,
*
args
,
**
kwargs
):
node
=
self
.
get_object
()
if
node
.
is_root
():
node_value
=
node
.
value
post_value
=
request
.
data
.
get
(
'value'
)
if
node_value
!=
post_value
:
return
Response
(
{
"msg"
:
_
(
"You cant update the root node name"
)},
status
=
400
)
return
super
()
.
update
(
request
,
*
args
,
**
kwargs
)
class
NodeChildrenApi
(
mixins
.
ListModelMixin
,
generics
.
CreateAPIView
):
queryset
=
Node
.
objects
.
all
()
...
...
@@ -108,9 +116,9 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
queryset
.
append
(
node
)
if
query_all
:
children
=
node
.
get_all_children
()
.
annotate
(
Count
(
"assets"
))
children
=
node
.
get_all_children
()
else
:
children
=
node
.
get_children
()
.
annotate
(
Count
(
"assets"
))
children
=
node
.
get_children
()
queryset
.
extend
(
list
(
children
))
if
query_assets
:
...
...
apps/assets/models/node.py
View file @
e59b95e9
...
...
@@ -199,6 +199,11 @@ class Node(OrgModelMixin):
else
:
return
cls
.
create_root_node
()
@classmethod
def
default_node
(
cls
):
defaults
=
{
'value'
:
'Default'
}
return
cls
.
objects
.
get_or_create
(
defaults
=
defaults
,
key
=
'0'
)
@classmethod
def
generate_fake
(
cls
,
count
=
100
):
import
random
...
...
apps/assets/serializers/asset.py
View file @
e59b95e9
...
...
@@ -20,7 +20,7 @@ class AssetSerializer(BulkSerializerMixin, serializers.ModelSerializer):
model
=
Asset
list_serializer_class
=
BulkListSerializer
fields
=
'__all__'
# validators = [] # If not set to [], partial bulk update will be error
validators
=
[]
def
get_field_names
(
self
,
declared_fields
,
info
):
fields
=
super
()
.
get_field_names
(
declared_fields
,
info
)
...
...
apps/assets/serializers/node.py
View file @
e59b95e9
...
...
@@ -68,7 +68,7 @@ class NodeSerializer(serializers.ModelSerializer):
@staticmethod
def
get_assets_amount
(
obj
):
return
obj
.
assets__count
if
hasattr
(
obj
,
'assets__count'
)
else
0
return
obj
.
get_all_assets
()
.
count
()
@staticmethod
def
get_tree_id
(
obj
):
...
...
apps/assets/templates/assets/asset_list.html
View file @
e59b95e9
...
...
@@ -194,9 +194,10 @@ function addTreeNode() {
$
.
post
(
url
,
{},
function
(
data
,
status
){
if
(
status
===
"success"
)
{
var
newNode
=
{
id
:
data
[
"key"
],
name
:
data
[
"value"
],
id
:
data
[
"id"
],
pId
:
parentNode
.
node_
id
node_
id
:
data
[
"id"
],
pId
:
parentNode
.
id
};
newNode
.
checked
=
zTree
.
getSelectedNodes
()[
0
].
checked
;
zTree
.
addNodes
(
parentNode
,
0
,
newNode
);
...
...
@@ -287,7 +288,9 @@ function onRename(event, treeId, treeNode, isCancel){
APIUpdateAttr
({
url
:
url
,
body
:
JSON
.
stringify
(
data
),
method
:
"PATCH"
method
:
"PATCH"
,
success_message
:
"{% trans 'Rename success' %}"
,
fail_message
:
"{% trans 'Rename failed, do not change the root node name' %}"
})
}
...
...
apps/assets/views/asset.py
View file @
e59b95e9
...
...
@@ -8,7 +8,6 @@ import codecs
import
chardet
from
io
import
StringIO
from
django.conf
import
settings
from
django.db
import
transaction
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.views.generic
import
TemplateView
,
ListView
,
View
...
...
@@ -25,11 +24,12 @@ from django.shortcuts import redirect
from
django.contrib.messages.views
import
SuccessMessageMixin
from
common.mixins
import
JSONResponseMixin
from
common.utils
import
get_object_or_none
,
get_logger
,
is_uuid
from
common.utils
import
get_object_or_none
,
get_logger
from
common.permissions
import
AdminUserRequiredMixin
from
common.const
import
create_success_msg
,
update_success_msg
from
orgs.utils
import
current_org
from
..
import
forms
from
..models
import
Asset
,
AdminUser
,
SystemUser
,
Label
,
Node
,
Domain
from
common.permissions
import
AdminUserRequiredMixin
__all__
=
[
...
...
@@ -44,6 +44,9 @@ class AssetListView(AdminUserRequiredMixin, TemplateView):
template_name
=
'assets/asset_list.html'
def
get_context_data
(
self
,
**
kwargs
):
if
current_org
.
is_default
():
Node
.
default_node
()
else
:
Node
.
root
()
context
=
{
'app'
:
_
(
'Assets'
),
...
...
apps/i18n/zh/LC_MESSAGES/django.mo
View file @
e59b95e9
No preview for this file type
apps/i18n/zh/LC_MESSAGES/django.po
View file @
e59b95e9
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-
03 15:14
+0800\n"
"POT-Creation-Date: 2018-08-
10 16:10
+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"
...
...
@@ -17,15 +17,19 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: assets/api/node.py:97
#: assets/api/node.py:58
msgid "You cant update the root node name"
msgstr ""
#: assets/api/node.py:82
msgid "New node {}"
msgstr "新节点 {}"
#: assets/api/node.py:2
32
#: assets/api/node.py:2
21
msgid "更新节点资产硬件信息: {}"
msgstr ""
#: assets/api/node.py:2
45
#: assets/api/node.py:2
34
msgid "测试节点下资产是否可连接: {}"
msgstr ""
...
...
@@ -54,7 +58,7 @@ msgid "Label"
msgstr "标签"
#: assets/forms/asset.py:37 assets/forms/asset.py:76 assets/models/asset.py:76
#: assets/models/domain.py:47 assets/templates/assets/user_asset_list.html:1
8
8
#: assets/models/domain.py:47 assets/templates/assets/user_asset_list.html:1
6
8
msgid "Domain"
msgstr "网域"
...
...
@@ -63,7 +67,7 @@ msgstr "网域"
#: assets/templates/assets/asset_update.html:35 perms/forms.py:50
#: perms/forms.py:57 perms/models.py:78
#: perms/templates/perms/asset_permission_list.html:57
#: perms/templates/perms/asset_permission_list.html:1
42
#: perms/templates/perms/asset_permission_list.html:1
51
msgid "Node"
msgstr "节点"
...
...
@@ -91,7 +95,7 @@ msgstr "选择资产"
#: assets/templates/assets/asset_detail.html:69
#: assets/templates/assets/domain_gateway_list.html:58
#: assets/templates/assets/system_user_asset.html:51
#: assets/templates/assets/user_asset_list.html:1
8
3
#: assets/templates/assets/user_asset_list.html:1
6
3
msgid "Port"
msgstr "端口"
...
...
@@ -106,7 +110,7 @@ msgstr "端口"
#: perms/models.py:31
#: perms/templates/perms/asset_permission_create_update.html:40
#: perms/templates/perms/asset_permission_list.html:56
#: perms/templates/perms/asset_permission_list.html:1
39
#: perms/templates/perms/asset_permission_list.html:1
48
#: terminal/backends/command/models.py:13 terminal/models.py:128
#: terminal/templates/terminal/command_list.html:40
#: terminal/templates/terminal/command_list.html:73
...
...
@@ -118,7 +122,7 @@ msgstr "资产"
#: assets/forms/domain.py:55 assets/forms/user.py:79 assets/forms/user.py:139
#: assets/models/base.py:22 assets/models/cluster.py:18
#: assets/models/domain.py:18 assets/models/group.py:20
#: assets/models/label.py:1
7
assets/templates/assets/admin_user_detail.html:56
#: assets/models/label.py:1
8
assets/templates/assets/admin_user_detail.html:56
#: assets/templates/assets/admin_user_list.html:23
#: assets/templates/assets/domain_detail.html:56
#: assets/templates/assets/domain_gateway_list.html:56
...
...
@@ -142,9 +146,6 @@ msgstr "资产"
#: users/templates/users/user_list.html:23
#: users/templates/users/user_profile.html:51
#: users/templates/users/user_pubkey_update.html:53
#: xpack/plugins/orgs/templates/orgs/org_detail.html:52
#: xpack/plugins/orgs/templates/orgs/org_list.html:12
#: xpack/templates/orgs/org_list.html:12
msgid "Name"
msgstr "名称"
...
...
@@ -221,7 +222,7 @@ msgstr "如果选择手动登录模式,用户名和密码则不需要填写"
#: assets/templates/assets/domain_gateway_list.html:57
#: assets/templates/assets/system_user_asset.html:50
#: assets/templates/assets/user_asset_list.html:46
#: assets/templates/assets/user_asset_list.html:1
82 common/forms.py:144
#: assets/templates/assets/user_asset_list.html:1
62 common/forms.py:145
#: perms/templates/perms/asset_permission_asset.html:55
#: users/templates/users/login_log_list.html:52
#: users/templates/users/user_granted_asset.html:45
...
...
@@ -235,7 +236,7 @@ msgstr "IP"
#: assets/templates/assets/asset_list.html:91
#: assets/templates/assets/system_user_asset.html:49
#: assets/templates/assets/user_asset_list.html:45
#: assets/templates/assets/user_asset_list.html:1
81 common/forms.py:143
#: assets/templates/assets/user_asset_list.html:1
61 common/forms.py:144
#: perms/templates/perms/asset_permission_asset.html:54
#: users/templates/users/user_granted_asset.html:44
#: users/templates/users/user_group_granted_asset.html:44
...
...
@@ -247,19 +248,19 @@ msgstr "主机名"
#: assets/templates/assets/domain_gateway_list.html:59
#: assets/templates/assets/system_user_detail.html:70
#: assets/templates/assets/system_user_list.html:28
#: assets/templates/assets/user_asset_list.html:1
8
4
#: assets/templates/assets/user_asset_list.html:1
6
4
#: terminal/templates/terminal/session_list.html:75
msgid "Protocol"
msgstr "协议"
#: assets/models/asset.py:74 assets/templates/assets/asset_detail.html:97
#: assets/templates/assets/user_asset_list.html:1
8
5
#: assets/templates/assets/user_asset_list.html:1
6
5
msgid "Platform"
msgstr "系统平台"
#: assets/models/asset.py:81 assets/models/domain.py:49
#: assets/models/label.py:2
0
assets/templates/assets/asset_detail.html:105
#: assets/templates/assets/user_asset_list.html:1
8
9
#: assets/models/label.py:2
1
assets/templates/assets/asset_detail.html:105
#: assets/templates/assets/user_asset_list.html:1
6
9
msgid "Is active"
msgstr "激活"
...
...
@@ -308,7 +309,7 @@ msgid "Disk info"
msgstr "硬盘信息"
#: assets/models/asset.py:111 assets/templates/assets/asset_detail.html:101
#: assets/templates/assets/user_asset_list.html:1
8
6
#: assets/templates/assets/user_asset_list.html:1
6
6
msgid "OS"
msgstr "操作系统"
...
...
@@ -344,7 +345,7 @@ msgstr "创建者"
#: assets/models/asset.py:126 assets/models/cluster.py:26
#: assets/models/domain.py:21 assets/models/group.py:22
#: assets/models/label.py:2
3
assets/templates/assets/admin_user_detail.html:64
#: assets/models/label.py:2
4
assets/templates/assets/admin_user_detail.html:64
#: assets/templates/assets/domain_detail.html:68
#: assets/templates/assets/system_user_detail.html:96
#: ops/templates/ops/adhoc_detail.html:90 ops/templates/ops/task_detail.html:63
...
...
@@ -352,14 +353,13 @@ msgstr "创建者"
#: perms/templates/perms/asset_permission_detail.html:94
#: terminal/templates/terminal/terminal_detail.html:59 users/models/group.py:17
#: users/templates/users/user_group_detail.html:63
#: xpack/plugins/orgs/templates/orgs/org_detail.html:60
msgid "Date created"
msgstr "创建日期"
#: assets/models/asset.py:128 assets/models/base.py:27
#: assets/models/cluster.py:29 assets/models/domain.py:19
#: assets/models/domain.py:48 assets/models/group.py:23
#: assets/models/label.py:2
1
assets/templates/assets/admin_user_detail.html:72
#: assets/models/label.py:2
2
assets/templates/assets/admin_user_detail.html:72
#: assets/templates/assets/admin_user_list.html:29
#: assets/templates/assets/asset_detail.html:125
#: assets/templates/assets/domain_detail.html:76
...
...
@@ -367,7 +367,7 @@ msgstr "创建日期"
#: assets/templates/assets/domain_list.html:25
#: assets/templates/assets/system_user_detail.html:104
#: assets/templates/assets/system_user_list.html:34
#: assets/templates/assets/user_asset_list.html:1
9
0 common/models.py:30
#: assets/templates/assets/user_asset_list.html:1
7
0 common/models.py:30
#: ops/models/adhoc.py:42 orgs/models.py:15 perms/models.py:39
#: perms/models.py:85 perms/templates/perms/asset_permission_detail.html:102
#: terminal/models.py:27 terminal/templates/terminal/terminal_detail.html:63
...
...
@@ -376,9 +376,6 @@ msgstr "创建日期"
#: users/templates/users/user_group_detail.html:67
#: users/templates/users/user_group_list.html:14
#: users/templates/users/user_profile.html:130
#: xpack/plugins/orgs/templates/orgs/org_detail.html:64
#: xpack/plugins/orgs/templates/orgs/org_list.html:15
#: xpack/templates/orgs/org_list.html:14
msgid "Comment"
msgstr "备注"
...
...
@@ -423,7 +420,7 @@ msgstr "运营商"
msgid "Default"
msgstr "默认"
#: assets/models/cluster.py:36 assets/models/label.py:1
3
#: assets/models/cluster.py:36 assets/models/label.py:1
4
#: users/models/user.py:360
msgid "System"
msgstr "系统"
...
...
@@ -444,13 +441,13 @@ msgstr "资产组"
msgid "Default asset group"
msgstr "默认资产组"
#: assets/models/label.py:1
4
audits/models.py:11
#: assets/models/label.py:1
5
audits/models.py:11
#: audits/templates/audits/ftp_log_list.html:33
#: audits/templates/audits/ftp_log_list.html:71 perms/forms.py:16
#: perms/forms.py:41 perms/models.py:29
#: perms/templates/perms/asset_permission_create_update.html:36
#: perms/templates/perms/asset_permission_list.html:54
#: perms/templates/perms/asset_permission_list.html:1
33
#: perms/templates/perms/asset_permission_list.html:1
42
#: terminal/backends/command/models.py:12 terminal/models.py:127
#: terminal/templates/terminal/command_list.html:32
#: terminal/templates/terminal/command_list.html:72
...
...
@@ -458,20 +455,16 @@ msgstr "默认资产组"
#: terminal/templates/terminal/session_list.html:71 users/forms.py:312
#: users/models/user.py:33 users/models/user.py:348
#: users/templates/users/user_group_detail.html:78
#: users/templates/users/user_group_list.html:13 users/views/user.py:380
#: xpack/plugins/orgs/forms.py:26
#: xpack/plugins/orgs/templates/orgs/org_detail.html:113
#: xpack/plugins/orgs/templates/orgs/org_list.html:14
#: xpack/templates/orgs/org_list.html:13
#: users/templates/users/user_group_list.html:13 users/views/user.py:379
msgid "User"
msgstr "用户"
#: assets/models/label.py:1
8
assets/models/node.py:19
#: assets/models/label.py:1
9
assets/models/node.py:19
#: assets/templates/assets/label_list.html:15 common/models.py:27
msgid "Value"
msgstr "值"
#: assets/models/label.py:
19
#: assets/models/label.py:
20
msgid "Category"
msgstr "分类"
...
...
@@ -492,9 +485,9 @@ msgstr "手动登录"
#: assets/templates/assets/system_user_asset.html:21
#: assets/views/admin_user.py:29 assets/views/admin_user.py:47
#: assets/views/admin_user.py:63 assets/views/admin_user.py:78
#: assets/views/admin_user.py:102 assets/views/asset.py:
49
#: assets/views/asset.py:9
6 assets/views/asset.py:156 assets/views/asset.py:173
#: assets/views/asset.py:
197
assets/views/domain.py:29
#: assets/views/admin_user.py:102 assets/views/asset.py:
52
#: assets/views/asset.py:9
9 assets/views/asset.py:159 assets/views/asset.py:176
#: assets/views/asset.py:
200
assets/views/domain.py:29
#: assets/views/domain.py:45 assets/views/domain.py:61
#: assets/views/domain.py:74 assets/views/domain.py:98
#: assets/views/domain.py:126 assets/views/domain.py:145
...
...
@@ -528,13 +521,13 @@ msgstr "Shell"
msgid "Login mode"
msgstr "登录模式"
#: assets/models/user.py:181 assets/templates/assets/user_asset_list.html:1
8
7
#: assets/models/user.py:181 assets/templates/assets/user_asset_list.html:1
6
7
#: audits/models.py:14 audits/templates/audits/ftp_log_list.html:49
#: audits/templates/audits/ftp_log_list.html:73 perms/forms.py:53
#: perms/models.py:33 perms/models.py:80
#: perms/templates/perms/asset_permission_detail.html:140
#: perms/templates/perms/asset_permission_list.html:58
#: perms/templates/perms/asset_permission_list.html:1
45
templates/_nav.html:26
#: perms/templates/perms/asset_permission_list.html:1
54
templates/_nav.html:26
#: terminal/backends/command/models.py:14 terminal/models.py:129
#: terminal/templates/terminal/command_list.html:48
#: terminal/templates/terminal/command_list.html:74
...
...
@@ -628,7 +621,7 @@ msgstr "资产csv文件"
msgid "If set id, will use this id update asset existed"
msgstr "如果设置了id,则会使用该行信息更新该id的资产"
#: assets/templates/assets/_asset_list_modal.html:7 assets/views/asset.py:5
0
#: assets/templates/assets/_asset_list_modal.html:7 assets/views/asset.py:5
3
#: templates/_nav.html:23
msgid "Asset list"
msgstr "资产列表"
...
...
@@ -715,12 +708,12 @@ msgstr "重置"
msgid "Submit"
msgstr "提交"
#: assets/templates/assets/_user_asset_detail_modal.html:
7
#: assets/templates/assets/asset_detail.html:20 assets/views/asset.py:
198
#: assets/templates/assets/_user_asset_detail_modal.html:
11
#: assets/templates/assets/asset_detail.html:20 assets/views/asset.py:
201
msgid "Asset detail"
msgstr "资产详情"
#: assets/templates/assets/_user_asset_detail_modal.html:2
0
#: assets/templates/assets/_user_asset_detail_modal.html:2
3
#: templates/_modal.html:21
msgid "Close"
msgstr "关闭"
...
...
@@ -780,7 +773,7 @@ msgstr "测试"
#: assets/templates/assets/admin_user_detail.html:24
#: assets/templates/assets/admin_user_list.html:85
#: assets/templates/assets/asset_detail.html:24
#: assets/templates/assets/asset_list.html:1
8
0
#: assets/templates/assets/asset_list.html:1
7
0
#: assets/templates/assets/domain_detail.html:24
#: assets/templates/assets/domain_detail.html:103
#: assets/templates/assets/domain_gateway_list.html:85
...
...
@@ -789,7 +782,7 @@ msgstr "测试"
#: assets/templates/assets/system_user_detail.html:26
#: assets/templates/assets/system_user_list.html:89
#: perms/templates/perms/asset_permission_detail.html:30
#: perms/templates/perms/asset_permission_list.html:
191
#: perms/templates/perms/asset_permission_list.html:
200
#: terminal/templates/terminal/terminal_detail.html:16
#: terminal/templates/terminal/terminal_list.html:71
#: users/templates/users/user_detail.html:25
...
...
@@ -798,16 +791,13 @@ msgstr "测试"
#: users/templates/users/user_list.html:77
#: users/templates/users/user_profile.html:151
#: users/templates/users/user_profile.html:180
#: xpack/plugins/orgs/templates/orgs/org_detail.html:25
#: xpack/plugins/orgs/templates/orgs/org_list.html:48
#: xpack/templates/orgs/org_list.html:43
msgid "Update"
msgstr "更新"
#: assets/templates/assets/admin_user_detail.html:28
#: assets/templates/assets/admin_user_list.html:86
#: assets/templates/assets/asset_detail.html:28
#: assets/templates/assets/asset_list.html:1
8
1
#: assets/templates/assets/asset_list.html:1
7
1
#: assets/templates/assets/domain_detail.html:28
#: assets/templates/assets/domain_detail.html:104
#: assets/templates/assets/domain_gateway_list.html:86
...
...
@@ -817,16 +807,13 @@ msgstr "更新"
#: assets/templates/assets/system_user_list.html:90
#: ops/templates/ops/task_list.html:72
#: perms/templates/perms/asset_permission_detail.html:34
#: perms/templates/perms/asset_permission_list.html:
192
#: perms/templates/perms/asset_permission_list.html:
201
#: terminal/templates/terminal/terminal_list.html:73
#: users/templates/users/user_detail.html:30
#: users/templates/users/user_group_detail.html:32
#: users/templates/users/user_group_list.html:45
#: users/templates/users/user_list.html:81
#: users/templates/users/user_list.html:85
#: xpack/plugins/orgs/templates/orgs/org_detail.html:29
#: xpack/plugins/orgs/templates/orgs/org_list.html:50
#: xpack/templates/orgs/org_list.html:45
msgid "Delete"
msgstr "删除"
...
...
@@ -841,7 +828,7 @@ msgstr "选择节点"
#: assets/templates/assets/admin_user_detail.html:100
#: assets/templates/assets/asset_detail.html:200
#: assets/templates/assets/asset_list.html:6
46
#: assets/templates/assets/asset_list.html:6
30
#: assets/templates/assets/system_user_detail.html:195
#: assets/templates/assets/system_user_list.html:139 templates/_modal.html:22
#: terminal/templates/terminal/session_detail.html:108
...
...
@@ -853,8 +840,6 @@ msgstr "选择节点"
#: users/templates/users/user_group_list.html:86
#: users/templates/users/user_list.html:200
#: users/templates/users/user_profile.html:222
#: xpack/plugins/orgs/templates/orgs/org_create_update.html:33
#: xpack/templates/orgs/org_list.html:86
msgid "Confirm"
msgstr "确认"
...
...
@@ -888,8 +873,6 @@ msgstr "比例"
#: terminal/templates/terminal/terminal_list.html:36
#: users/templates/users/user_group_list.html:15
#: users/templates/users/user_list.html:29
#: xpack/plugins/orgs/templates/orgs/org_list.html:16
#: xpack/templates/orgs/org_list.html:15
msgid "Action"
msgstr "动作"
...
...
@@ -945,7 +928,7 @@ msgstr "刷新"
msgid "Update successfully!"
msgstr "更新成功"
#: assets/templates/assets/asset_list.html:68 assets/views/asset.py:
97
#: assets/templates/assets/asset_list.html:68 assets/views/asset.py:
100
msgid "Create asset"
msgstr "创建资产"
...
...
@@ -1023,43 +1006,50 @@ msgstr "仅显示当前节点资产"
msgid "Displays all child node assets"
msgstr "显示所有子节点资产"
#: assets/templates/assets/asset_list.html:2
23
#: assets/templates/assets/asset_list.html:2
07
msgid "Create node failed"
msgstr "创建节点失败"
#: assets/templates/assets/asset_list.html:2
35
#: assets/templates/assets/asset_list.html:2
19
msgid "Have child node, cancel"
msgstr "存在子节点,不能删除"
#: assets/templates/assets/asset_list.html:2
37
#: assets/templates/assets/asset_list.html:2
21
msgid "Have assets, cancel"
msgstr "存在资产,不能删除"
#: assets/templates/assets/asset_list.html:641
#: assets/templates/assets/asset_list.html:292
msgid "Rename success"
msgstr "重命名成功"
#: assets/templates/assets/asset_list.html:293
msgid "Rename failed, do not change the root node name"
msgstr "重命名失败,不可以更改根节点名称"
#: assets/templates/assets/asset_list.html:625
#: assets/templates/assets/system_user_list.html:134
#: users/templates/users/user_detail.html:369
#: users/templates/users/user_detail.html:394
#: users/templates/users/user_detail.html:461
#: users/templates/users/user_group_list.html:81
#: users/templates/users/user_list.html:195
#: xpack/templates/orgs/org_list.html:81
msgid "Are you sure?"
msgstr "你确认吗?"
#: assets/templates/assets/asset_list.html:6
42
#: assets/templates/assets/asset_list.html:6
26
msgid "This will delete the selected assets !!!"
msgstr "删除选择资产"
#: assets/templates/assets/asset_list.html:6
50
#: assets/templates/assets/asset_list.html:6
34
msgid "Asset Deleted."
msgstr "已被删除"
#: assets/templates/assets/asset_list.html:6
51
#: assets/templates/assets/asset_list.html:6
56
#: assets/templates/assets/asset_list.html:6
35
#: assets/templates/assets/asset_list.html:6
40
msgid "Asset Delete"
msgstr "删除"
#: assets/templates/assets/asset_list.html:6
55
#: assets/templates/assets/asset_list.html:6
39
msgid "Asset Deleting failed."
msgstr "删除失败"
...
...
@@ -1189,19 +1179,19 @@ msgstr "更新管理用户"
msgid "Admin user detail"
msgstr "管理用户详情"
#: assets/views/asset.py:6
3
templates/_nav_user.html:4
#: assets/views/asset.py:6
6
templates/_nav_user.html:4
msgid "My assets"
msgstr "我的资产"
#: assets/views/asset.py:1
57
#: assets/views/asset.py:1
60
msgid "Bulk update asset"
msgstr "批量更新资产"
#: assets/views/asset.py:17
4
#: assets/views/asset.py:17
7
msgid "Update asset"
msgstr "更新资产"
#: assets/views/asset.py:31
4
#: assets/views/asset.py:31
7
msgid "already exists"
msgstr "已经存在"
...
...
@@ -1299,7 +1289,11 @@ msgstr "邮件已经发送{}, 请检查"
msgid "Test ldap success"
msgstr "连接LDAP成功"
#: common/api.py:80
#: common/api.py:72
msgid "Search no entry matched in ou {}"
msgstr ""
#: common/api.py:81
msgid "Match {} s users"
msgstr "匹配 {} 个用户"
...
...
@@ -1361,7 +1355,7 @@ msgstr "SMTP密码"
msgid "Some provider use token except password"
msgstr "一些邮件提供商需要输入的是Token"
#: common/forms.py:96 common/forms.py:13
6
#: common/forms.py:96 common/forms.py:13
7
msgid "Use SSL"
msgstr "使用SSL"
...
...
@@ -1389,20 +1383,24 @@ msgstr "绑定DN"
msgid "User OU"
msgstr "用户OU"
#: common/forms.py:120
#: common/forms.py:118
msgid "Use | split User OUs"
msgstr ""
#: common/forms.py:121
msgid "User search filter"
msgstr "用户过滤器"
#: common/forms.py:12
1
#: common/forms.py:12
2
#, python-format
msgid "Choice may be (cn|uid|sAMAccountName)=%(user)s)"
msgstr "可能的选项是(cn或uid或sAMAccountName=%(user)s)"
#: common/forms.py:12
4
#: common/forms.py:12
5
msgid "User attr map"
msgstr "LDAP属性映射"
#: common/forms.py:13
1
#: common/forms.py:13
2
msgid ""
"User attr map present how to map LDAP user attr to jumpserver, username,name,"
"email is jumpserver attr"
...
...
@@ -1410,116 +1408,116 @@ msgstr ""
"用户属性映射代表怎样将LDAP中用户属性映射到jumpserver用户上,username, name,"
"email 是jumpserver的属性"
#: common/forms.py:13
8
#: common/forms.py:13
9
msgid "Enable LDAP auth"
msgstr "启用LDAP认证"
#: common/forms.py:14
7
#: common/forms.py:14
8
msgid "List sort by"
msgstr "资产列表排序"
#: common/forms.py:15
0
#: common/forms.py:15
1
msgid "Heartbeat interval"
msgstr "心跳间隔"
#: common/forms.py:15
0
ops/models/adhoc.py:37
#: common/forms.py:15
1
ops/models/adhoc.py:37
msgid "Units: seconds"
msgstr "单位: 秒"
#: common/forms.py:15
3
#: common/forms.py:15
4
msgid "Password auth"
msgstr "密码认证"
#: common/forms.py:15
6
#: common/forms.py:15
7
msgid "Public key auth"
msgstr "密钥认证"
#: common/forms.py:1
59
common/templates/common/terminal_setting.html:68
#: common/forms.py:1
60
common/templates/common/terminal_setting.html:68
#: terminal/forms.py:30 terminal/models.py:21
msgid "Command storage"
msgstr "命令存储"
#: common/forms.py:16
0
#: common/forms.py:16
1
msgid ""
"Set terminal storage setting, `default` is the using as default,You can set "
"other storage and some terminal using"
msgstr "设置终端命令存储,default是默认用的存储方式"
#: common/forms.py:16
5
common/templates/common/terminal_setting.html:86
#: common/forms.py:16
6
common/templates/common/terminal_setting.html:86
#: terminal/forms.py:35 terminal/models.py:22
msgid "Replay storage"
msgstr "录像存储"
#: common/forms.py:16
6
#: common/forms.py:16
7
msgid ""
"Set replay storage setting, `default` is the using as default,You can set "
"other storage and some terminal using"
msgstr "设置终端录像存储,default是默认用的存储方式"
#: common/forms.py:17
6
#: common/forms.py:17
7
msgid "MFA Secondary certification"
msgstr "MFA 二次认证"
#: common/forms.py:17
8
#: common/forms.py:17
9
msgid ""
"After opening, the user login must use MFA secondary authentication (valid "
"for all users, including administrators)"
msgstr "开启后,用户登录必须使用MFA二次认证(对所有用户有效,包括管理员)"
#: common/forms.py:18
5
#: common/forms.py:18
6
msgid "Limit the number of login failures"
msgstr "限制登录失败次数"
#: common/forms.py:19
0
#: common/forms.py:19
1
msgid "No logon interval"
msgstr "禁止登录时间间隔"
#: common/forms.py:19
2
#: common/forms.py:19
3
msgid ""
"Tip :(unit/minute) if the user has failed to log in for a limited number of "
"times, no login is allowed during this time interval."
msgstr ""
"提示:(单位 / 分钟)当用户登录失败次数达到限制后,那么在此时间间隔内禁止登录."
#: common/forms.py:19
8
#: common/forms.py:19
9
msgid "Password minimum length"
msgstr "密码最小长度 "
#: common/forms.py:20
5
#: common/forms.py:20
6
msgid "Must contain capital letters"
msgstr "必须包含大写字母"
#: common/forms.py:20
7
#: common/forms.py:20
8
msgid ""
"After opening, the user password changes and resets must contain uppercase "
"letters"
msgstr "开启后,用户密码修改、重置必须包含大写字母"
#: common/forms.py:21
3
#: common/forms.py:21
4
msgid "Must contain lowercase letters"
msgstr "必须包含小写字母"
#: common/forms.py:21
4
#: common/forms.py:21
5
msgid ""
"After opening, the user password changes and resets must contain lowercase "
"letters"
msgstr "开启后,用户密码修改、重置必须包含小写字母"
#: common/forms.py:22
0
#: common/forms.py:22
1
msgid "Must contain numeric characters"
msgstr "必须包含数字字符"
#: common/forms.py:22
1
#: common/forms.py:22
2
msgid ""
"After opening, the user password changes and resets must contain numeric "
"characters"
msgstr "开启后,用户密码修改、重置必须包含数字字符"
#: common/forms.py:22
7
#: common/forms.py:22
8
msgid "Must contain special characters"
msgstr "必须包含特殊字符"
#: common/forms.py:22
8
#: common/forms.py:22
9
msgid ""
"After opening, the user password changes and resets must contain special "
"characters"
...
...
@@ -1660,7 +1658,6 @@ msgid "Become"
msgstr "Become"
#: ops/models/adhoc.py:161 users/templates/users/user_group_detail.html:59
#: xpack/plugins/orgs/templates/orgs/org_detail.html:56
msgid "Create by"
msgstr "创建者"
...
...
@@ -1880,13 +1877,13 @@ msgid "Task run history"
msgstr "执行历史"
#: perms/forms.py:20 users/forms.py:265 users/forms.py:270 users/forms.py:282
#: users/forms.py:316
xpack/plugins/orgs/forms.py:30
#: users/forms.py:316
msgid "Select users"
msgstr "选择用户"
#: perms/forms.py:44 perms/models.py:30 perms/models.py:79
#: perms/templates/perms/asset_permission_list.html:55
#: perms/templates/perms/asset_permission_list.html:1
36
templates/_nav.html:14
#: perms/templates/perms/asset_permission_list.html:1
45
templates/_nav.html:14
#: users/models/group.py:26 users/models/user.py:57
#: users/templates/users/_select_user_modal.html:16
#: users/templates/users/user_detail.html:200
...
...
@@ -1934,8 +1931,6 @@ msgstr "添加资产"
#: perms/templates/perms/asset_permission_user.html:97
#: perms/templates/perms/asset_permission_user.html:125
#: users/templates/users/user_group_detail.html:95
#: xpack/plugins/orgs/templates/orgs/org_detail.html:93
#: xpack/plugins/orgs/templates/orgs/org_detail.html:130
msgid "Add"
msgstr "添加"
...
...
@@ -2041,7 +2036,7 @@ msgstr "文档"
#: users/templates/users/user_profile.html:17
#: users/templates/users/user_profile_update.html:37
#: users/templates/users/user_profile_update.html:57
#: users/templates/users/user_pubkey_update.html:37 users/views/user.py:36
2
#: users/templates/users/user_pubkey_update.html:37 users/views/user.py:36
1
msgid "Profile"
msgstr "个人信息"
...
...
@@ -2096,7 +2091,7 @@ msgstr ""
#: users/views/group.py:61 users/views/group.py:78 users/views/group.py:94
#: users/views/login.py:333 users/views/login.py:397 users/views/user.py:68
#: users/views/user.py:83 users/views/user.py:111 users/views/user.py:193
#: users/views/user.py:34
9 users/views/user.py:399 users/views/user.py:434
#: users/views/user.py:34
8 users/views/user.py:398 users/views/user.py:433
msgid "Users"
msgstr "用户管理"
...
...
@@ -2367,7 +2362,7 @@ msgid ""
"You should use your ssh client tools connect terminal: {} <br /> <br />{}"
msgstr "你可以使用ssh客户端工具连接终端"
#: users/api.py:23
2
users/templates/users/login.html:50
#: users/api.py:23
5
users/templates/users/login.html:50
msgid "Log in frequently and try again later"
msgstr "登录频繁, 稍后重试"
...
...
@@ -2902,7 +2897,6 @@ msgid "After unlocking the user, the user can log in normally."
msgstr "解除用户登录限制后,此用户即可正常登录"
#: users/templates/users/user_group_create_update.html:31
#: xpack/plugins/orgs/templates/orgs/org_create_update.html:32
msgid "Cancel"
msgstr "取消"
...
...
@@ -2913,33 +2907,27 @@ msgid "User group detail"
msgstr "用户组详情"
#: users/templates/users/user_group_detail.html:86
#: xpack/plugins/orgs/templates/orgs/org_detail.html:121
msgid "Add user"
msgstr "添加用户"
#: users/templates/users/user_group_list.html:5 users/views/group.py:44
#: xpack/templates/orgs/org_list.html:5
msgid "Create user group"
msgstr "创建用户组"
#: users/templates/users/user_group_list.html:82
#: xpack/templates/orgs/org_list.html:82
msgid "This will delete the selected groups !!!"
msgstr "删除选择组"
#: users/templates/users/user_group_list.html:90
#: xpack/templates/orgs/org_list.html:90
msgid "UserGroups Deleted."
msgstr "用户组删除"
#: users/templates/users/user_group_list.html:91
#: users/templates/users/user_group_list.html:96
#: xpack/templates/orgs/org_list.html:91 xpack/templates/orgs/org_list.html:96
msgid "UserGroups Delete"
msgstr "用户组删除"
#: users/templates/users/user_group_list.html:95
#: xpack/templates/orgs/org_list.html:95
msgid "UserGroup Deleting failed."
msgstr "用户组删除失败"
...
...
@@ -3169,7 +3157,7 @@ msgstr "用户组授权资产"
msgid "Please enable cookies and try again."
msgstr "设置你的浏览器支持cookie"
#: users/views/login.py:181 users/views/user.py:51
9 users/views/user.py:544
#: users/views/login.py:181 users/views/user.py:51
8 users/views/user.py:543
msgid "MFA code invalid"
msgstr "MFA码认证失败"
...
...
@@ -3210,7 +3198,7 @@ msgstr "Token错误或失效"
msgid "Password not same"
msgstr "密码不一致"
#: users/views/login.py:295 users/views/user.py:127 users/views/user.py:41
7
#: users/views/login.py:295 users/views/user.py:127 users/views/user.py:41
6
msgid "* Your password does not meet the requirements"
msgstr "* 您的密码不符合要求"
...
...
@@ -3230,89 +3218,74 @@ msgstr "批量更新用户成功"
msgid "Invalid file."
msgstr "文件不合法"
#: users/views/user.py:3
50
#: users/views/user.py:3
49
msgid "User granted assets"
msgstr "用户授权资产"
#: users/views/user.py:38
1
#: users/views/user.py:38
0
msgid "Profile setting"
msgstr "个人信息设置"
#: users/views/user.py:
400
#: users/views/user.py:
399
msgid "Password update"
msgstr "密码更新"
#: users/views/user.py:43
5
#: users/views/user.py:43
4
msgid "Public key update"
msgstr "密钥更新"
#: users/views/user.py:47
6
#: users/views/user.py:47
5
msgid "Password invalid"
msgstr "用户名或密码无效"
#: users/views/user.py:5
70
#: users/views/user.py:5
69
msgid "MFA enable success"
msgstr "MFA 绑定成功"
#: users/views/user.py:57
1
#: users/views/user.py:57
0
msgid "MFA enable success, return login page"
msgstr "MFA 绑定成功,返回到登录页面"
#: users/views/user.py:57
3
#: users/views/user.py:57
2
msgid "MFA disable success"
msgstr "MFA 解绑成功"
#: users/views/user.py:57
4
#: users/views/user.py:57
3
msgid "MFA disable success, return login page"
msgstr "MFA 解绑成功,返回登录页面"
#: xpack/plugins/orgs/forms.py:14
#: xpack/plugins/orgs/templates/orgs/org_detail.html:76
#: xpack/plugins/orgs/templates/orgs/org_list.html:13
msgid "Admin"
msgstr "管理员"
#~ msgid "Admin"
#~ msgstr "管理员"
#: xpack/plugins/orgs/forms.py:18
msgid "Select admins"
msgstr "选择管理员"
#~ msgid "Select admins"
#~ msgstr "选择管理员"
#: xpack/plugins/orgs/meta.py:7
msgid "Organization"
msgstr "组织管理"
#~ msgid "Organization"
#~ msgstr "组织管理"
#: xpack/plugins/orgs/templates/orgs/org_detail.html:22
#: xpack/plugins/orgs/views.py:73
msgid "Org detail"
msgstr "组织详情"
#~ msgid "Org detail"
#~ msgstr "组织详情"
#: xpack/plugins/orgs/templates/orgs/org_detail.html:84
msgid "Add admin"
msgstr "添加管理员"
#~ msgid "Add admin"
#~ msgstr "添加管理员"
#: xpack/plugins/orgs/templates/orgs/org_list.html:5
msgid "Create organization "
msgstr "创建组织"
#~ msgid "Create organization "
#~ msgstr "创建组织"
#: xpack/plugins/orgs/views.py:24
msgid "Org"
msgstr "组织"
#~ msgid "Org"
#~ msgstr "组织"
#: xpack/plugins/orgs/views.py:25
msgid "Org list"
msgstr "组织列表"
#~ msgid "Org list"
#~ msgstr "组织列表"
#: xpack/plugins/orgs/views.py:40 xpack/plugins/orgs/views.py:56
#: xpack/plugins/orgs/views.py:72
msgid "Orgs"
msgstr "组织"
#~ msgid "Orgs"
#~ msgstr "组织"
#: xpack/plugins/orgs/views.py:41
msgid "Create org"
msgstr "创建组织"
#~ msgid "Create org"
#~ msgstr "创建组织"
#: xpack/plugins/orgs/views.py:57
msgid "Update org"
msgstr "更新组织"
#~ msgid "Update org"
#~ msgstr "更新组织"
#~ msgid "* required Must set exact system platform, Windows, Linux ..."
#~ msgstr "* required 必须准确设置操作系统平台,如Windows, Linux ..."
...
...
apps/jumpserver/settings.py
View file @
e59b95e9
...
...
@@ -322,6 +322,7 @@ REST_FRAMEWORK = {
'common.permissions.IsOrgAdmin'
,
),
'DEFAULT_AUTHENTICATION_CLASSES'
:
(
# 'rest_framework.authentication.BasicAuthentication',
'users.authentication.AccessKeyAuthentication'
,
'users.authentication.AccessTokenAuthentication'
,
'users.authentication.PrivateTokenAuthentication'
,
...
...
apps/perms/api.py
View file @
e59b95e9
...
...
@@ -5,7 +5,6 @@ from django.shortcuts import get_object_or_404
from
rest_framework.views
import
APIView
,
Response
from
rest_framework.generics
import
ListAPIView
,
get_object_or_404
,
RetrieveUpdateAPIView
from
rest_framework
import
viewsets
from
rest_framework.pagination
import
LimitOffsetPagination
from
common.utils
import
set_or_append_attr_bulk
,
get_object_or_none
from
common.permissions
import
IsValidUser
,
IsOrgAdmin
,
IsOrgAdminOrAppUser
...
...
apps/perms/utils.py
View file @
e59b95e9
...
...
@@ -139,8 +139,6 @@ class AssetPermissionUtil:
for
node
,
system_users
in
nodes
.
items
():
_assets
=
node
.
get_all_assets
()
.
valid
()
.
prefetch_related
(
'nodes'
)
for
asset
in
_assets
:
if
isinstance
(
asset
,
Node
):
print
(
_assets
)
assets
[
asset
]
.
update
(
system_users
)
self
.
_assets
=
assets
return
self
.
_assets
...
...
apps/terminal/api.py
View file @
e59b95e9
...
...
@@ -243,7 +243,6 @@ class CommandViewSet(viewsets.ViewSet):
def
create
(
self
,
request
,
*
args
,
**
kwargs
):
serializer
=
self
.
serializer_class
(
data
=
request
.
data
,
many
=
True
)
if
serializer
.
is_valid
():
print
(
serializer
.
validated_data
)
ok
=
self
.
command_store
.
bulk_save
(
serializer
.
validated_data
)
if
ok
:
return
Response
(
"ok"
,
status
=
201
)
...
...
apps/users/serializers.py
View file @
e59b95e9
...
...
@@ -23,6 +23,7 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer):
'first_name'
,
'last_name'
,
'password'
,
'_private_key'
,
'_public_key'
,
'_otp_secret_key'
,
'user_permissions'
]
# validators = []
def
get_field_names
(
self
,
declared_fields
,
info
):
fields
=
super
(
UserSerializer
,
self
)
.
get_field_names
(
declared_fields
,
info
)
...
...
@@ -71,7 +72,7 @@ class UserGroupSerializer(BulkSerializerMixin, serializers.ModelSerializer):
class
UserGroupUpdateMemeberSerializer
(
serializers
.
ModelSerializer
):
users
=
serializers
.
PrimaryKeyRelatedField
(
many
=
True
,
queryset
=
User
.
objects
.
all
())
users
=
serializers
.
PrimaryKeyRelatedField
(
many
=
True
,
queryset
=
User
.
objects
.
all
())
class
Meta
:
model
=
UserGroup
...
...
requirements/requirements.txt
View file @
e59b95e9
...
...
@@ -14,11 +14,11 @@ coreapi==2.3.3
coreschema==0.0.4
cryptography==2.1.4
decorator==4.1.2
Django==2.
0.7
Django==2.
1.0
django-auth-ldap==1.3.0
django-bootstrap3==9.1.0
django-celery-beat==1.1.1
django-filter==
1.1
.0
django-filter==
2.0
.0
django-formtools==2.1
django-ranged-response==0.2.0
django-redis-cache==1.7.1
...
...
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