From 31850c3351c208472df8a2ca67bc290bd079c140 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 12 Dec 2022 13:37:59 -0800 Subject: [PATCH] fix empty set permissions --- src/documents/serialisers.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py index f3ef49f86..ab7efe6de 100644 --- a/src/documents/serialisers.py +++ b/src/documents/serialisers.py @@ -116,10 +116,13 @@ class SetPermissionsMixin: } if set_permissions is not None: for action in permissions_dict: - users = set_permissions[action]["users"] - permissions_dict[action]["users"] = self._validate_user_ids(users) - groups = set_permissions[action]["groups"] - permissions_dict[action]["groups"] = self._validate_group_ids(groups) + if action in set_permissions: + users = set_permissions[action]["users"] + permissions_dict[action]["users"] = self._validate_user_ids(users) + groups = set_permissions[action]["groups"] + permissions_dict[action]["groups"] = self._validate_group_ids( + groups, + ) return permissions_dict def _set_permissions(self, permissions, object):