From 48d6c9bb8f82a557c460e10b281dc68f40b7152c Mon Sep 17 00:00:00 2001 From: Anton Krytskyi Date: Mon, 10 Nov 2025 16:59:04 +0200 Subject: [PATCH] add filtering by email for users --- api/users/serializers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/users/serializers.py b/api/users/serializers.py index 301985ac744..e3fa4d723e8 100644 --- a/api/users/serializers.py +++ b/api/users/serializers.py @@ -71,6 +71,7 @@ class UserSerializer(JSONAPISerializer): 'middle_names', 'family_name', 'id', + 'username', ]) writeable_method_fields = frozenset([ 'accepted_terms_of_service', @@ -98,6 +99,10 @@ class UserSerializer(JSONAPISerializer): can_view_reviews = ShowIfCurrentUser(ser.SerializerMethodField(help_text='Whether the current user has the `view_submissions` permission to ANY reviews provider.')) accepted_terms_of_service = ShowIfCurrentUser(ser.SerializerMethodField()) + # Expose a username field for filtering only. It maps to the OSFUser.username. + # Marked write_only so it does not appear in responses. + username = ser.CharField(write_only=True, required=False) + links = HideIfDisabled( LinksField( {