mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
Only rebuild ancestor list on post_* events
This commit is contained in:
@@ -106,13 +106,14 @@ def emit_update_inventory_on_created_or_deleted(sender, **kwargs):
|
|||||||
if inventory is not None:
|
if inventory is not None:
|
||||||
update_inventory_computed_fields.delay(inventory.id, True)
|
update_inventory_computed_fields.delay(inventory.id, True)
|
||||||
|
|
||||||
def rebuild_role_ancestor_list(reverse, model, instance, pk_set, **kwargs):
|
def rebuild_role_ancestor_list(reverse, model, instance, pk_set, action, **kwargs):
|
||||||
'When a role parent is added or removed, update our role hierarchy list'
|
'When a role parent is added or removed, update our role hierarchy list'
|
||||||
if reverse:
|
if action in ['post_add', 'post_remove', 'post_clear']:
|
||||||
for id in pk_set:
|
if reverse:
|
||||||
model.objects.get(id=id).rebuild_role_ancestor_list()
|
for id in pk_set:
|
||||||
else:
|
model.objects.get(id=id).rebuild_role_ancestor_list()
|
||||||
instance.rebuild_role_ancestor_list()
|
else:
|
||||||
|
instance.rebuild_role_ancestor_list()
|
||||||
|
|
||||||
def sync_superuser_status_to_rbac(instance, **kwargs):
|
def sync_superuser_status_to_rbac(instance, **kwargs):
|
||||||
'When the is_superuser flag is changed on a user, reflect that in the membership of the System Admnistrator role'
|
'When the is_superuser flag is changed on a user, reflect that in the membership of the System Admnistrator role'
|
||||||
|
|||||||
Reference in New Issue
Block a user