web/user: fix source connections not being filtered (#4778)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-02-24 11:22:02 +01:00 committed by GitHub
parent 9c82024fd5
commit b7e4ad7234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -206,5 +206,6 @@ class UserSourceConnectionViewSet(
queryset = UserSourceConnection.objects.all() queryset = UserSourceConnection.objects.all()
serializer_class = UserSourceConnectionSerializer serializer_class = UserSourceConnectionSerializer
permission_classes = [OwnerSuperuserPermissions] permission_classes = [OwnerSuperuserPermissions]
filterset_fields = ["user"]
filter_backends = [OwnerFilter, DjangoFilterBackend, OrderingFilter, SearchFilter] filter_backends = [OwnerFilter, DjangoFilterBackend, OrderingFilter, SearchFilter]
ordering = ["pk"] ordering = ["pk"]

View File

@ -17568,6 +17568,10 @@ paths:
description: A search term. description: A search term.
schema: schema:
type: string type: string
- in: query
name: user
schema:
type: integer
tags: tags:
- sources - sources
security: security:

View File

@ -1,6 +1,7 @@
import { renderSourceIcon } from "@goauthentik/admin/sources/SourceViewPage"; import { renderSourceIcon } from "@goauthentik/admin/sources/SourceViewPage";
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
import { EVENT_REFRESH } from "@goauthentik/common/constants"; import { EVENT_REFRESH } from "@goauthentik/common/constants";
import { me } from "@goauthentik/common/users";
import { AKElement } from "@goauthentik/elements/Base"; import { AKElement } from "@goauthentik/elements/Base";
import "@goauthentik/elements/EmptyState"; import "@goauthentik/elements/EmptyState";
import "@goauthentik/user/user-settings/sources/SourceSettingsOAuth"; import "@goauthentik/user/user-settings/sources/SourceSettingsOAuth";
@ -58,10 +59,11 @@ export class UserSourceSettingsPage extends AKElement {
}); });
} }
firstUpdated(): void { async firstUpdated(): Promise<void> {
const user = await me();
this.sourceSettings = new SourcesApi(DEFAULT_CONFIG).sourcesAllUserSettingsList(); this.sourceSettings = new SourcesApi(DEFAULT_CONFIG).sourcesAllUserSettingsList();
new SourcesApi(DEFAULT_CONFIG).sourcesUserConnectionsAllList().then((connections) => { this.connections = await new SourcesApi(DEFAULT_CONFIG).sourcesUserConnectionsAllList({
this.connections = connections; user: user.user.pk,
}); });
} }