mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
ensure team organizations are assigned to credentials
This commit is contained in:
parent
23024c8fad
commit
dbe3f628d4
@ -25,5 +25,6 @@ class Migration(migrations.Migration):
|
||||
name='use_role',
|
||||
field=awx.main.fields.ImplicitRoleField(related_name='+', parent_role=[b'admin_role'], to='main.Role', null=b'True'),
|
||||
),
|
||||
migrations.RunPython(rbac.infer_credential_org_from_team),
|
||||
migrations.RunPython(rbac.rebuild_role_hierarchy),
|
||||
]
|
||||
|
||||
@ -489,4 +489,7 @@ def rebuild_role_hierarchy(apps, schema_editor):
|
||||
logger.info('Rebuild completed in %f seconds' % (stop - start))
|
||||
logger.info('Done.')
|
||||
|
||||
|
||||
def infer_credential_org_from_team(apps, schema_editor):
|
||||
Credential = apps.get_model('main', "Credential")
|
||||
for cred in Credential.objects.exclude(deprecated_team__isnull=True):
|
||||
_update_credential_parents(cred.deprecated_team.organization, cred)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user