core/api: allow filtering users by uid, add uid to search

closes #2428

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-03-03 10:19:56 +01:00
parent da1ea51dad
commit 1e1d9f1bdd
2 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -3036,6 +3036,10 @@ paths:
description: A search term.
schema:
type: string
- in: query
name: uid
schema:
type: string
- in: query
name: username
schema: