mirror of
https://github.com/ansible/awx.git
synced 2026-03-08 21:19:26 -02:30
Add a post_migrate signal handler to rebuild the Org roles
particularly, the execution_environment_admin_role.
This commit is contained in:
@@ -17,6 +17,7 @@ from django.db.models.signals import (
|
||||
pre_delete,
|
||||
post_delete,
|
||||
m2m_changed,
|
||||
post_migrate,
|
||||
)
|
||||
from django.dispatch import receiver
|
||||
from django.contrib.auth import SESSION_KEY
|
||||
@@ -109,6 +110,19 @@ def emit_update_inventory_on_created_or_deleted(sender, **kwargs):
|
||||
connection.on_commit(lambda: update_inventory_computed_fields.delay(inventory.id))
|
||||
|
||||
|
||||
def fixup_missing_org_ee_admin_roles(app_config, **kwargs):
|
||||
if app_config.label != 'main':
|
||||
return
|
||||
|
||||
print("Fixing up missing EE admin roles.")
|
||||
with disable_activity_stream():
|
||||
for org in Organization.objects.all():
|
||||
org.save()
|
||||
|
||||
|
||||
post_migrate.connect(fixup_missing_org_ee_admin_roles)
|
||||
|
||||
|
||||
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'
|
||||
if action == 'post_add':
|
||||
|
||||
Reference in New Issue
Block a user