mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Merge pull request #7140 from ryanpetrello/fix-7050
properly copy user owner roles when migrating v1 SSH to SSH + Vault
This commit is contained in:
commit
e1e1f5d15f
@ -125,8 +125,10 @@ def migrate_to_v2_credentials(apps, schema_editor):
|
|||||||
if any([getattr(cred, field) for field in ssh_type.defined_fields]):
|
if any([getattr(cred, field) for field in ssh_type.defined_fields]):
|
||||||
new_cred.save(force_insert=True)
|
new_cred.save(force_insert=True)
|
||||||
|
|
||||||
# copy parent roles
|
# copy rbac roles
|
||||||
for role_type in ('read_role', 'admin_role', 'use_role'):
|
for role_type in ('read_role', 'admin_role', 'use_role'):
|
||||||
|
for member in getattr(cred, role_type).members.all():
|
||||||
|
getattr(new_cred, role_type).members.add(member)
|
||||||
for role in getattr(cred, role_type).parents.all():
|
for role in getattr(cred, role_type).parents.all():
|
||||||
getattr(new_cred, role_type).parents.add(role)
|
getattr(new_cred, role_type).parents.add(role)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user