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
e5250294
Commit
e5250294
authored
Oct 18, 2019
by
BaiJiangJie
Committed by
老广
Oct 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dev export (#3355)
* [Update] 修复导出资产csv文件为空的问题 * [Update] 修改获取系统用户 API 只返回节点数量
parent
f3dc9b88
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
5 deletions
+10
-5
filters.py
apps/assets/filters.py
+1
-1
user.py
apps/assets/models/user.py
+4
-0
system_user.py
apps/assets/serializers/system_user.py
+3
-2
asset_list.html
apps/assets/templates/assets/asset_list.html
+2
-1
filters.py
apps/common/filters.py
+0
-1
No files found.
apps/assets/filters.py
View file @
e5250294
...
@@ -53,7 +53,7 @@ class AssetByNodeFilterBackend(filters.BaseFilterBackend):
...
@@ -53,7 +53,7 @@ class AssetByNodeFilterBackend(filters.BaseFilterBackend):
return
queryset
return
queryset
if
node
is
None
:
if
node
is
None
:
return
queryset
.
none
()
return
queryset
query_all
=
self
.
is_query_all
(
request
)
query_all
=
self
.
is_query_all
(
request
)
if
query_all
:
if
query_all
:
pattern
=
node
.
get_all_children_pattern
(
with_self
=
True
)
pattern
=
node
.
get_all_children_pattern
(
with_self
=
True
)
...
...
apps/assets/models/user.py
View file @
e5250294
...
@@ -120,6 +120,10 @@ class SystemUser(AssetUser):
...
@@ -120,6 +120,10 @@ class SystemUser(AssetUser):
def
__str__
(
self
):
def
__str__
(
self
):
return
'{0.name}({0.username})'
.
format
(
self
)
return
'{0.name}({0.username})'
.
format
(
self
)
@property
def
nodes_amount
(
self
):
return
self
.
nodes
.
all
()
.
count
()
@property
@property
def
login_mode_display
(
self
):
def
login_mode_display
(
self
):
return
self
.
get_login_mode_display
()
return
self
.
get_login_mode_display
()
...
...
apps/assets/serializers/system_user.py
View file @
e5250294
...
@@ -26,13 +26,14 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
...
@@ -26,13 +26,14 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
fields
=
[
fields
=
[
'id'
,
'name'
,
'username'
,
'password'
,
'public_key'
,
'private_key'
,
'id'
,
'name'
,
'username'
,
'password'
,
'public_key'
,
'private_key'
,
'login_mode'
,
'login_mode_display'
,
'priority'
,
'protocol'
,
'login_mode'
,
'login_mode_display'
,
'priority'
,
'protocol'
,
'auto_push'
,
'cmd_filters'
,
'sudo'
,
'shell'
,
'comment'
,
'nodes'
,
'auto_push'
,
'cmd_filters'
,
'sudo'
,
'shell'
,
'comment'
,
'assets_amount'
,
'auto_generate_key'
'assets_amount'
,
'
nodes_amount'
,
'
auto_generate_key'
]
]
extra_kwargs
=
{
extra_kwargs
=
{
'password'
:
{
"write_only"
:
True
},
'password'
:
{
"write_only"
:
True
},
'public_key'
:
{
"write_only"
:
True
},
'public_key'
:
{
"write_only"
:
True
},
'private_key'
:
{
"write_only"
:
True
},
'private_key'
:
{
"write_only"
:
True
},
'nodes_amount'
:
{
'label'
:
_
(
'Node'
)},
'assets_amount'
:
{
'label'
:
_
(
'Asset'
)},
'assets_amount'
:
{
'label'
:
_
(
'Asset'
)},
'login_mode_display'
:
{
'label'
:
_
(
'Login mode display'
)},
'login_mode_display'
:
{
'label'
:
_
(
'Login mode display'
)},
'created_by'
:
{
'read_only'
:
True
},
'created_by'
:
{
'read_only'
:
True
},
...
...
apps/assets/templates/assets/asset_list.html
View file @
e5250294
...
@@ -292,7 +292,8 @@ $(document).ready(function(){
...
@@ -292,7 +292,8 @@ $(document).ready(function(){
format
:
'csv'
,
format
:
'csv'
,
params
:
{
params
:
{
search
:
search
,
search
:
search
,
node_id
:
current_node_id
||
''
node_id
:
current_node_id
||
''
,
show_current_asset
:
getCookie
(
'show_current_asset'
)
}
}
};
};
APIExportData
(
props
);
APIExportData
(
props
);
...
...
apps/common/filters.py
View file @
e5250294
...
@@ -63,7 +63,6 @@ class IDSpmFilter(filters.BaseFilterBackend):
...
@@ -63,7 +63,6 @@ class IDSpmFilter(filters.BaseFilterBackend):
cache_key
=
const
.
KEY_CACHE_RESOURCES_ID
.
format
(
spm
)
cache_key
=
const
.
KEY_CACHE_RESOURCES_ID
.
format
(
spm
)
resources_id
=
cache
.
get
(
cache_key
)
resources_id
=
cache
.
get
(
cache_key
)
if
not
resources_id
or
not
isinstance
(
resources_id
,
list
):
if
not
resources_id
or
not
isinstance
(
resources_id
,
list
):
queryset
=
queryset
.
none
()
return
queryset
return
queryset
queryset
=
queryset
.
filter
(
id__in
=
resources_id
)
queryset
=
queryset
.
filter
(
id__in
=
resources_id
)
return
queryset
return
queryset
...
...
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