Fix inherited permissions should not display per user in permissions form

This commit is contained in:
shamoon
2023-03-17 20:49:47 -07:00
parent 4cfc416cdc
commit ae0c585918
9 changed files with 58 additions and 11 deletions

View File

@@ -63,6 +63,7 @@ def set_permissions_for_object(permissions, object):
users_to_remove = get_users_with_perms(
object,
only_with_perms_in=[permission],
with_group_users=False,
)
if len(users_to_add) > 0 and len(users_to_remove) > 0:
users_to_remove = users_to_remove.difference(users_to_add)

View File

@@ -161,6 +161,7 @@ class OwnedObjectSerializer(serializers.ModelSerializer, SetPermissionsMixin):
"users": get_users_with_perms(
obj,
only_with_perms_in=[view_codename],
with_group_users=False,
).values_list("id", flat=True),
"groups": get_groups_with_only_permission(
obj,
@@ -171,6 +172,7 @@ class OwnedObjectSerializer(serializers.ModelSerializer, SetPermissionsMixin):
"users": get_users_with_perms(
obj,
only_with_perms_in=[change_codename],
with_group_users=False,
).values_list("id", flat=True),
"groups": get_groups_with_only_permission(
obj,

View File

@@ -964,6 +964,7 @@ class UiSettingsView(GenericAPIView):
"id": user.id,
"username": user.username,
"is_superuser": user.is_superuser,
"groups": user.groups.values_list("id", flat=True),
},
"settings": ui_settings,
"permissions": roles,