Browse Source

Merge pull request #1197 from jumpserver/dev

[Update] 更新迁移脚本
pull/1204/head
老广 7 years ago committed by GitHub
parent
commit
3ccb6637d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      utils/2018_04_11_migrate_permissions.sh

6
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

Loading…
Cancel
Save