From a016f99450be9e56dd99df4a642faa0c01b6420c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 30 Aug 2021 12:51:14 +0200 Subject: [PATCH] core: fix user_obj being empty on token API Signed-off-by: Jens Langhammer --- authentik/core/api/tokens.py | 2 +- web/src/pages/tokens/TokenListPage.ts | 2 +- website/docs/releases/v2021.8.md | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/authentik/core/api/tokens.py b/authentik/core/api/tokens.py index b128e5bc8..7d4f6249e 100644 --- a/authentik/core/api/tokens.py +++ b/authentik/core/api/tokens.py @@ -23,7 +23,7 @@ from authentik.managed.api import ManagedSerializer class TokenSerializer(ManagedSerializer, ModelSerializer): """Token Serializer""" - user_obj = UserSerializer(required=False) + user_obj = UserSerializer(required=False, source="user") def validate(self, attrs: dict[Any, str]) -> dict[Any, str]: """Ensure only API or App password tokens are created.""" diff --git a/web/src/pages/tokens/TokenListPage.ts b/web/src/pages/tokens/TokenListPage.ts index cb26e8ddc..f066b40b5 100644 --- a/web/src/pages/tokens/TokenListPage.ts +++ b/web/src/pages/tokens/TokenListPage.ts @@ -103,7 +103,7 @@ export class TokenListPage extends TablePage { row(item: Token): TemplateResult[] { return [ html`${item.identifier}`, - html`${item.userObj?.username}`, + html`${item.userObj?.username}`, html`${item.expiring ? t`Yes` : t`No`}`, html`${item.expiring ? item.expires?.toLocaleString() : "-"}`, html`${IntentToLabel(item.intent || IntentEnum.Api)}`, diff --git a/website/docs/releases/v2021.8.md b/website/docs/releases/v2021.8.md index e6c434707..12b962669 100644 --- a/website/docs/releases/v2021.8.md +++ b/website/docs/releases/v2021.8.md @@ -101,6 +101,7 @@ slug: "2021.8" ## Fixed in 2021.8.4 - api: add basic rate limiting for sentry proxy endpoint +- core: fix user_obj being empty on token API - outpost/embedded: only send requests for non-akprox paths when we're doing proxy mode - outpost/ldap: delay user information removal upon closing of connection - policies/password: fix PasswordStage not being usable with prompt stages