diff --git a/utils/2018_04_11_migrate_permissions.sh b/utils/2018_04_11_migrate_permissions.sh index 3f86ff003..bbc29c388 100644 --- a/utils/2018_04_11_migrate_permissions.sh +++ b/utils/2018_04_11_migrate_permissions.sh @@ -3,6 +3,7 @@ python ../apps/manage.py shell << EOF from perms.models import * +from assets.models import SystemUser for old in NodePermission.objects.all(): perm = AssetPermission.objects.create( @@ -20,5 +21,10 @@ for old in NodePermission.objects.all(): perm.user_groups.add(old.user_group) perm.nodes.add(old.node) perm.system_users.add(old.system_user) + + for s in SystemUser.objects.all(): + nodes = list(s.nodes.all()) + s.nodes.set([]) + s.nodes.set(nodes) EOF