updated given linting feedback
This commit is contained in:
parent
5d4ecb7f9e
commit
a7a5d13637
@ -8,11 +8,9 @@ if groups is None:
|
||||
sys.exit()
|
||||
|
||||
for params in groups:
|
||||
groupname=params['name']
|
||||
groupname = params["name"]
|
||||
|
||||
group, created = AdminGroup.objects.get_or_create(
|
||||
name=groupname
|
||||
)
|
||||
group, created = AdminGroup.objects.get_or_create(name=groupname)
|
||||
|
||||
if created:
|
||||
print("👥 Created group", groupname)
|
||||
|
@ -13,15 +13,15 @@ if object_permissions is None:
|
||||
for params in object_permissions:
|
||||
|
||||
object_permission, created = ObjectPermission.objects.get_or_create(
|
||||
name=params['name'],
|
||||
description=params['description'],
|
||||
enabled=params['enabled'],
|
||||
actions=params['actions']
|
||||
name=params["name"],
|
||||
description=params["description"],
|
||||
enabled=params["enabled"],
|
||||
actions=params["actions"],
|
||||
)
|
||||
|
||||
# Need to try to pass a list of model_name and app_label for more than just the current all objects.
|
||||
#object_types = ContentType.objects.filter(app_label__in=params.pop("object_types"))
|
||||
#object_permission.object_types.set(ContentType.objects.filter(app_label__in=params.pop("object_types")))
|
||||
# Need to try to pass a list of model_name and app_label for more than the current ALL
|
||||
# object_types = ContentType.objects.filter(app_label__in=params.pop("object_types"))
|
||||
# object_permission.object_types.set(ContentType.objects.filter(app_label__in=params.pop("object_types")))
|
||||
object_permission.object_types.set(ContentType.objects.all())
|
||||
object_permission.save()
|
||||
|
||||
@ -32,13 +32,17 @@ for params in object_permissions:
|
||||
|
||||
if group:
|
||||
object_permission.groups.add(group)
|
||||
print(" 👥 Assigned group %s object permission of %s" % (groupname, object_permission.name))
|
||||
print(
|
||||
" 👥 Assigned group %s object permission of %s" % (groupname, object_permission.name)
|
||||
)
|
||||
|
||||
for username in params.get("users", []):
|
||||
user = AdminUser.objects.get(username=username)
|
||||
|
||||
if user:
|
||||
object_permission.users.add(user)
|
||||
print(" 👤 Assigned user %s object permission of %s" % (username, object_permission.name))
|
||||
print(
|
||||
" 👤 Assigned user %s object permission of %s" % (username, object_permission.name)
|
||||
)
|
||||
|
||||
object_permission.save()
|
||||
|
Loading…
Reference in New Issue
Block a user