adjusts users and groups startup scripts to accomdate non-uniqueness
This commit is contained in:
parent
5a4e9d7a14
commit
e6e7647f32
|
@ -29,6 +29,6 @@ with file.open('r') as stream:
|
||||||
if user_permissions:
|
if user_permissions:
|
||||||
user.user_permissions.clear()
|
user.user_permissions.clear()
|
||||||
for permission_codename in user_details.get('permissions', []):
|
for permission_codename in user_details.get('permissions', []):
|
||||||
permission = Permission.objects.get(codename=permission_codename)
|
for permission in Permission.objects.filter(codename=permission_codename):
|
||||||
user.user_permissions.add(permission)
|
user.user_permissions.add(permission)
|
||||||
user.save()
|
user.save()
|
||||||
|
|
|
@ -29,5 +29,5 @@ with file.open('r') as stream:
|
||||||
group.permissions.clear()
|
group.permissions.clear()
|
||||||
print("Permissions:", group.permissions.all())
|
print("Permissions:", group.permissions.all())
|
||||||
for permission_codename in group_details.get('permissions', []):
|
for permission_codename in group_details.get('permissions', []):
|
||||||
permission = Permission.objects.get(codename=permission_codename)
|
for permission in Permission.objects.filter(codename=permission_codename):
|
||||||
group.permissions.add(permission)
|
group.permissions.add(permission)
|
||||||
|
|
Loading…
Reference in New Issue