Merge pull request #148 from LBegnaud/master
adjusts users and groups startup scripts to accomdate non-uniqueness
This commit is contained in:
commit
b0287e344e
@ -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
Block a user