From 1614f3174fd574931b32e81844a9f091b0c241f3 Mon Sep 17 00:00:00 2001 From: "Jens L." Date: Thu, 13 Feb 2025 13:30:04 +0100 Subject: [PATCH] web/admin: fix source selection for identification stage (#13007) closes #12995 Signed-off-by: Jens Langhammer --- authentik/core/api/sources.py | 2 +- schema.yml | 5 +++++ .../stages/identification/IdentificationStageFormHelpers.ts | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/authentik/core/api/sources.py b/authentik/core/api/sources.py index c7d8205dd2..93154c1559 100644 --- a/authentik/core/api/sources.py +++ b/authentik/core/api/sources.py @@ -85,7 +85,7 @@ class SourceViewSet( serializer_class = SourceSerializer lookup_field = "slug" search_fields = ["slug", "name"] - filterset_fields = ["slug", "name", "managed"] + filterset_fields = ["slug", "name", "managed", "pbm_uuid"] def get_queryset(self): # pragma: no cover return Source.objects.select_subclasses() diff --git a/schema.yml b/schema.yml index 1e5d9466f3..452bbb5c10 100644 --- a/schema.yml +++ b/schema.yml @@ -25207,6 +25207,11 @@ paths: description: Number of results to return per page. schema: type: integer + - in: query + name: pbm_uuid + schema: + type: string + format: uuid - name: search required: false in: query diff --git a/web/src/admin/stages/identification/IdentificationStageFormHelpers.ts b/web/src/admin/stages/identification/IdentificationStageFormHelpers.ts index a6a3159048..e9846e60b3 100644 --- a/web/src/admin/stages/identification/IdentificationStageFormHelpers.ts +++ b/web/src/admin/stages/identification/IdentificationStageFormHelpers.ts @@ -27,13 +27,13 @@ export function sourcesSelector(instanceSources: string[] | undefined) { return async () => { const sourcesApi = new SourcesApi(DEFAULT_CONFIG); const sources = await Promise.allSettled( - instanceSources.map((instanceId) => - sourcesApi.sourcesAllRetrieve({ slug: instanceId }), - ), + instanceSources.map((instanceId) => sourcesApi.sourcesAllList({ pbmUuid: instanceId })), ); return sources .filter((s) => s.status === "fulfilled") .map((s) => s.value) + .filter((s) => s.pagination.count > 0) + .map((s) => s.results[0]) .map(sourceToSelect); }; }