mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2024-12-01 20:34:11 +01:00
update permission user & group lookup as suggested
This commit is contained in:
parent
474ca9e78f
commit
8678ad92ce
@ -43,7 +43,7 @@ for permission_name, permission_details in object_permissions.items():
|
|||||||
|
|
||||||
if permission_details.get("groups", 0):
|
if permission_details.get("groups", 0):
|
||||||
for groupname in permission_details["groups"]:
|
for groupname in permission_details["groups"]:
|
||||||
group = AdminGroup.objects.get(name=groupname)
|
group = AdminGroup.objects.filter(name=groupname).first()
|
||||||
|
|
||||||
if group:
|
if group:
|
||||||
object_permission.groups.add(group)
|
object_permission.groups.add(group)
|
||||||
@ -51,7 +51,7 @@ for permission_name, permission_details in object_permissions.items():
|
|||||||
|
|
||||||
if permission_details.get("users", 0):
|
if permission_details.get("users", 0):
|
||||||
for username in permission_details["users"]:
|
for username in permission_details["users"]:
|
||||||
user = AdminUser.objects.get(username=username)
|
user = AdminUser.objects.filter(username=username).first()
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
object_permission.users.add(user)
|
object_permission.users.add(user)
|
||||||
|
Loading…
Reference in New Issue
Block a user