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
57eed7fa
Unverified
Commit
57eed7fa
authored
Aug 26, 2019
by
BaiJiangJie
Committed by
GitHub
Aug 26, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3157 from jumpserver/v52_perms
[Update] 修复创建授权规则授权节点时,系统用户不自动推送的问题
parents
f47f8a66
fb940507
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
signals_handler.py
apps/assets/signals_handler.py
+10
-10
No files found.
apps/assets/signals_handler.py
View file @
57eed7fa
...
@@ -57,16 +57,16 @@ def on_system_user_update(sender, instance=None, created=True, **kwargs):
...
@@ -57,16 +57,16 @@ def on_system_user_update(sender, instance=None, created=True, **kwargs):
push_system_user_to_assets
.
delay
(
instance
,
assets
)
push_system_user_to_assets
.
delay
(
instance
,
assets
)
#
@receiver(m2m_changed, sender=SystemUser.nodes.through)
@receiver
(
m2m_changed
,
sender
=
SystemUser
.
nodes
.
through
)
#
def on_system_user_nodes_change(sender, instance=None, **kwargs):
def
on_system_user_nodes_change
(
sender
,
instance
=
None
,
**
kwargs
):
#
if instance and kwargs["action"] == "post_add":
if
instance
and
kwargs
[
"action"
]
==
"post_add"
:
#
logger.info("System user `{}` nodes update signal received".format(instance))
logger
.
info
(
"System user `{}` nodes update signal received"
.
format
(
instance
))
#
assets = set()
assets
=
set
()
#
nodes = kwargs['model'].objects.filter(pk__in=kwargs['pk_set'])
nodes
=
kwargs
[
'model'
]
.
objects
.
filter
(
pk__in
=
kwargs
[
'pk_set'
])
#
for node in nodes:
for
node
in
nodes
:
#
assets.update(set(node.get_all_assets()))
assets
.
update
(
set
(
node
.
get_all_assets
()))
#
instance.assets.add(*tuple(assets))
instance
.
assets
.
add
(
*
tuple
(
assets
))
#
@receiver
(
m2m_changed
,
sender
=
SystemUser
.
assets
.
through
)
@receiver
(
m2m_changed
,
sender
=
SystemUser
.
assets
.
through
)
def
on_system_user_assets_change
(
sender
,
instance
=
None
,
**
kwargs
):
def
on_system_user_assets_change
(
sender
,
instance
=
None
,
**
kwargs
):
...
...
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