diff --git a/authentik/providers/scim/clients/group.py b/authentik/providers/scim/clients/group.py index 7b2592a390b4..b0222590de5d 100644 --- a/authentik/providers/scim/clients/group.py +++ b/authentik/providers/scim/clients/group.py @@ -117,20 +117,23 @@ def _update(self, group: Group, connection: SCIMGroup): exclude_unset=True, ), ) + except ResourceMissing: + # Resource missing is handled by self.write, which will re-create the group + raise except SCIMRequestException: # Some providers don't support PUT on groups, so this is mainly a fix for the initial # sync, send patch add requests for all the users the group currently has users = list(group.users.order_by("id").values_list("id", flat=True)) self._patch_add_users(group, users) # Also update the group name - self._patch( + return self._patch( scim_group.id, PatchOperation( op=PatchOp.replace, value={ "id": connection.id, "displayName": group.name, - } + }, ), )