From 8dfdefd428f60d66f68ceb918e4fe8bb40992fbe Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 12 Apr 2018 17:02:04 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/2018_04_11_migrate_permissions.sh | 6 ++++++ 1 file changed, 6 insertions(+) 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