From 1e1d9f1bdda17eb82be9ae2728a1274229619aa1 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 3 Mar 2022 10:19:56 +0100 Subject: [PATCH] core/api: allow filtering users by uid, add uid to search closes #2428 Signed-off-by: Jens Langhammer --- authentik/core/api/users.py | 3 ++- schema.yml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/authentik/core/api/users.py b/authentik/core/api/users.py index 767007960..a5bb1e8c3 100644 --- a/authentik/core/api/users.py +++ b/authentik/core/api/users.py @@ -199,6 +199,7 @@ class UsersFilter(FilterSet): ) is_superuser = BooleanFilter(field_name="ak_groups", lookup_expr="is_superuser") + uid = CharFilter(field_name="uid") groups_by_name = ModelMultipleChoiceFilter( field_name="ak_groups__name", @@ -248,7 +249,7 @@ class UserViewSet(UsedByMixin, ModelViewSet): queryset = User.objects.none() ordering = ["username"] serializer_class = UserSerializer - search_fields = ["username", "name", "is_active", "email"] + search_fields = ["username", "name", "is_active", "email", "uid"] filterset_class = UsersFilter def get_queryset(self): # pragma: no cover diff --git a/schema.yml b/schema.yml index bf1a9f160..ba6eb5efa 100644 --- a/schema.yml +++ b/schema.yml @@ -3036,6 +3036,10 @@ paths: description: A search term. schema: type: string + - in: query + name: uid + schema: + type: string - in: query name: username schema: