Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
guo xiaoyong
Jumpserver
Commits
10ff7730
Commit
10ff7730
authored
4 years ago
by
xinwen
Committed by
老广
4 years ago
Browse files
Options
Download
Email Patches
Plain Diff
perf(perms): 优化根据资产获取授权的系统用户
parent
4f70e313
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/perms/utils/asset_permission.py
+4
-1
apps/perms/utils/asset_permission.py
with
4 additions
and
1 deletion
+4
-1
apps/perms/utils/asset_permission.py
+
4
-
1
View file @
10ff7730
...
...
@@ -11,16 +11,19 @@ logger = get_logger(__file__)
def
get_asset_system_users_id_with_actions
(
asset_perm_queryset
:
BasePermissionQuerySet
,
asset
:
Asset
):
asset_perms_id
=
set
(
asset_perm_queryset
.
values_list
(
'id'
,
flat
=
True
))
nodes
=
asset
.
get_nodes
()
node_keys
=
set
()
for
node
in
nodes
:
ancestor_keys
=
node
.
get_ancestor_keys
(
with_self
=
True
)
node_keys
.
update
(
ancestor_keys
)
queryset
=
a
sset
_p
erm
_queryset
.
filter
(
queryset
=
A
sset
P
erm
ission
.
objects
.
filter
(
id__in
=
asset_perms_id
)
.
filter
(
Q
(
assets
=
asset
)
|
Q
(
nodes__key__in
=
node_keys
)
)
asset_protocols
=
asset
.
protocols_as_dict
.
keys
()
values
=
queryset
.
filter
(
system_users__protocol__in
=
asset_protocols
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help