diff --git a/news/1775.bugfix b/news/1775.bugfix new file mode 100644 index 0000000000..f0b3cd0e47 --- /dev/null +++ b/news/1775.bugfix @@ -0,0 +1 @@ +Users service: Fixed edge case AttributeError if a user is enumerated but doesn't actually exist. @davisagli diff --git a/src/plone/restapi/services/users/get.py b/src/plone/restapi/services/users/get.py index e900b7de6f..235639c785 100644 --- a/src/plone/restapi/services/users/get.py +++ b/src/plone/restapi/services/users/get.py @@ -115,7 +115,9 @@ def _principal_search_results( principals = [] for principal_info in search_for_principal(hunter, self.search_term): principal_id = principal_info[id_key] - principals.append(get_principal_by_id(principal_id)) + principal = get_principal_by_id(principal_id) + if principal is not None: + principals.append(principal) return principals