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
c6e7872b
Commit
c6e7872b
authored
Nov 15, 2019
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 资产用户列表支持模糊搜索
parent
096d4a42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
base.py
apps/assets/backends/base.py
+7
-5
No files found.
apps/assets/backends/base.py
View file @
c6e7872b
...
...
@@ -38,6 +38,9 @@ class AssetUserQuerySet(list):
if
len
(
v
)
==
0
:
return
self
if
k
.
find
(
"__in"
)
>=
0
:
_k
=
k
.
split
(
'__'
)[
0
]
in_kwargs
[
_k
]
=
v
else
:
in_kwargs
[
k
]
=
v
for
k
in
in_kwargs
:
kwargs
.
pop
(
k
)
...
...
@@ -45,17 +48,16 @@ class AssetUserQuerySet(list):
if
len
(
in_kwargs
)
==
0
:
return
self
for
i
in
self
:
matched
=
Tru
e
matched
=
Fals
e
for
k
,
v
in
in_kwargs
.
items
():
key
=
k
.
split
(
'__'
)[
0
]
attr
=
getattr
(
i
,
key
,
None
)
attr
=
getattr
(
i
,
k
,
None
)
# 如果属性或者value中是uuid,则转换成string
if
isinstance
(
v
[
0
],
uuid
.
UUID
):
v
=
[
str
(
i
)
for
i
in
v
]
if
isinstance
(
attr
,
uuid
.
UUID
):
attr
=
str
(
attr
)
if
attr
not
in
v
:
matched
=
Fals
e
if
v
in
attr
:
matched
=
Tru
e
if
matched
:
queryset
.
append
(
i
)
return
AssetUserQuerySet
(
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