1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +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:
Ryan Petrello 2017-07-18 15:33:00 -04:00 committed by GitHub
commit e1e1f5d15f

View File

@ -125,8 +125,10 @@ def migrate_to_v2_credentials(apps, schema_editor):
if any([getattr(cred, field) for field in ssh_type.defined_fields]):
new_cred.save(force_insert=True)
# copy parent roles
# copy rbac roles
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():
getattr(new_cred, role_type).parents.add(role)