2018-04-11 04:23:35 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
|
|
|
|
python ../apps/manage.py shell << EOF
|
|
|
|
from perms.models import *
|
2018-04-12 09:02:04 +00:00
|
|
|
from assets.models import SystemUser
|
2018-04-11 04:23:35 +00:00
|
|
|
|
|
|
|
for old in NodePermission.objects.all():
|
2018-04-11 08:59:07 +00:00
|
|
|
perm = AssetPermission.objects.create(
|
2018-04-11 04:23:35 +00:00
|
|
|
name="{}-{}-{}".format(
|
|
|
|
old.node.value,
|
|
|
|
old.user_group.name,
|
|
|
|
old.system_user.name
|
|
|
|
),
|
|
|
|
is_active=old.is_active,
|
|
|
|
date_expired=old.date_expired,
|
|
|
|
created_by=old.date_expired,
|
|
|
|
date_created=old.date_created,
|
|
|
|
comment=old.comment,
|
|
|
|
)
|
|
|
|
perm.user_groups.add(old.user_group)
|
|
|
|
perm.nodes.add(old.node)
|
|
|
|
perm.system_users.add(old.system_user)
|
2018-04-12 09:02:04 +00:00
|
|
|
|
|
|
|
for s in SystemUser.objects.all():
|
|
|
|
nodes = list(s.nodes.all())
|
|
|
|
s.nodes.set([])
|
|
|
|
s.nodes.set(nodes)
|
2018-04-11 04:23:35 +00:00
|
|
|
EOF
|
|
|
|
|