From 477ff851093c936811a22d8cce303394184297ff Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 29 May 2021 18:43:23 +0200 Subject: [PATCH] flows: migrate flow_unenrollment to tenant Signed-off-by: Jens Langhammer --- authentik/flows/urls.py | 5 ----- authentik/tenants/api.py | 2 ++ schema.yml | 2 ++ web/src/api/legacy.ts | 4 ---- web/src/pages/user-settings/UserDetailsPage.ts | 15 +++++++++++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/authentik/flows/urls.py b/authentik/flows/urls.py index 3dad06e53..9be79ff68 100644 --- a/authentik/flows/urls.py +++ b/authentik/flows/urls.py @@ -16,11 +16,6 @@ urlpatterns = [ ToDefaultFlow.as_view(designation=FlowDesignation.INVALIDATION), name="default-invalidation", ), - path( - "-/default/unenrollment/", - ToDefaultFlow.as_view(designation=FlowDesignation.UNRENOLLMENT), - name="default-unenrollment", - ), path("-/cancel/", CancelView.as_view(), name="cancel"), path( "-/configure//", diff --git a/authentik/tenants/api.py b/authentik/tenants/api.py index 5af88344b..90898cbed 100644 --- a/authentik/tenants/api.py +++ b/authentik/tenants/api.py @@ -50,6 +50,8 @@ class CurrentTenantSerializer(PassiveSerializer): default=CONFIG.y("authentik.footer_links"), ) + flow_unenrollment = CharField(source="flow_unenrollment.slug", required=False) + class TenantViewSet(ModelViewSet): """Tenant Viewset""" diff --git a/schema.yml b/schema.yml index 0f26f9a91..e3b308944 100644 --- a/schema.yml +++ b/schema.yml @@ -16528,6 +16528,8 @@ components: name: Documentation - href: https://goauthentik.io/ name: authentik Website + flow_unenrollment: + type: string required: - branding_logo - branding_title diff --git a/web/src/api/legacy.ts b/web/src/api/legacy.ts index 871491be5..75af21a6a 100644 --- a/web/src/api/legacy.ts +++ b/web/src/api/legacy.ts @@ -11,10 +11,6 @@ export class AppURLManager { export class FlowURLManager { - static defaultUnenrollment(): string { - return "/flows/-/default/unenrollment/"; - } - static configure(stageUuid: string, rest: string): string { return `/flows/-/configure/${stageUuid}/${rest}`; } diff --git a/web/src/pages/user-settings/UserDetailsPage.ts b/web/src/pages/user-settings/UserDetailsPage.ts index b9c876a5f..87c77aba7 100644 --- a/web/src/pages/user-settings/UserDetailsPage.ts +++ b/web/src/pages/user-settings/UserDetailsPage.ts @@ -15,6 +15,8 @@ import "../../elements/forms/FormElement"; import "../../elements/EmptyState"; import "../../elements/forms/Form"; import "../../elements/forms/HorizontalFormElement"; +import { until } from "lit-html/directives/until"; +import { tenant } from "authentik-api/dist/src/api/Config"; @customElement("ak-user-details") export class UserDetailsPage extends LitElement { @@ -80,10 +82,15 @@ export class UserDetailsPage extends LitElement { - - ${t`Delete account`} - + ${until(tenant().then(tenant => { + if (tenant.flowUnenrollment) { + return html` + ${t`Delete account`} + `; + } + return html``; + }))}