flows: migrate flow_unenrollment to tenant
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -16,11 +16,6 @@ urlpatterns = [ | |||||||
|         ToDefaultFlow.as_view(designation=FlowDesignation.INVALIDATION), |         ToDefaultFlow.as_view(designation=FlowDesignation.INVALIDATION), | ||||||
|         name="default-invalidation", |         name="default-invalidation", | ||||||
|     ), |     ), | ||||||
|     path( |  | ||||||
|         "-/default/unenrollment/", |  | ||||||
|         ToDefaultFlow.as_view(designation=FlowDesignation.UNRENOLLMENT), |  | ||||||
|         name="default-unenrollment", |  | ||||||
|     ), |  | ||||||
|     path("-/cancel/", CancelView.as_view(), name="cancel"), |     path("-/cancel/", CancelView.as_view(), name="cancel"), | ||||||
|     path( |     path( | ||||||
|         "-/configure/<uuid:stage_uuid>/", |         "-/configure/<uuid:stage_uuid>/", | ||||||
|  | |||||||
| @ -50,6 +50,8 @@ class CurrentTenantSerializer(PassiveSerializer): | |||||||
|         default=CONFIG.y("authentik.footer_links"), |         default=CONFIG.y("authentik.footer_links"), | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|  |     flow_unenrollment = CharField(source="flow_unenrollment.slug", required=False) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TenantViewSet(ModelViewSet): | class TenantViewSet(ModelViewSet): | ||||||
|     """Tenant Viewset""" |     """Tenant Viewset""" | ||||||
|  | |||||||
| @ -16528,6 +16528,8 @@ components: | |||||||
|             name: Documentation |             name: Documentation | ||||||
|           - href: https://goauthentik.io/ |           - href: https://goauthentik.io/ | ||||||
|             name: authentik Website |             name: authentik Website | ||||||
|  |         flow_unenrollment: | ||||||
|  |           type: string | ||||||
|       required: |       required: | ||||||
|       - branding_logo |       - branding_logo | ||||||
|       - branding_title |       - branding_title | ||||||
|  | |||||||
| @ -11,10 +11,6 @@ export class AppURLManager { | |||||||
|  |  | ||||||
| export class FlowURLManager { | export class FlowURLManager { | ||||||
|  |  | ||||||
|     static defaultUnenrollment(): string { |  | ||||||
|         return "/flows/-/default/unenrollment/"; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     static configure(stageUuid: string, rest: string): string { |     static configure(stageUuid: string, rest: string): string { | ||||||
|         return `/flows/-/configure/${stageUuid}/${rest}`; |         return `/flows/-/configure/${stageUuid}/${rest}`; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -15,6 +15,8 @@ import "../../elements/forms/FormElement"; | |||||||
| import "../../elements/EmptyState"; | import "../../elements/EmptyState"; | ||||||
| import "../../elements/forms/Form"; | import "../../elements/forms/Form"; | ||||||
| import "../../elements/forms/HorizontalFormElement"; | import "../../elements/forms/HorizontalFormElement"; | ||||||
|  | import { until } from "lit-html/directives/until"; | ||||||
|  | import { tenant } from "authentik-api/dist/src/api/Config"; | ||||||
|  |  | ||||||
| @customElement("ak-user-details") | @customElement("ak-user-details") | ||||||
| export class UserDetailsPage extends LitElement { | export class UserDetailsPage extends LitElement { | ||||||
| @ -80,10 +82,15 @@ export class UserDetailsPage extends LitElement { | |||||||
|                                     <button class="pf-c-button pf-m-primary"> |                                     <button class="pf-c-button pf-m-primary"> | ||||||
|                                         ${t`Update`} |                                         ${t`Update`} | ||||||
|                                     </button> |                                     </button> | ||||||
|                                     <a class="pf-c-button pf-m-danger" |                                     ${until(tenant().then(tenant => { | ||||||
|                                         href="${FlowURLManager.defaultUnenrollment()}"> |                                         if (tenant.flowUnenrollment) { | ||||||
|                                         ${t`Delete account`} |                                             return html`<a class="pf-c-button pf-m-danger" | ||||||
|                                     </a> |                                                 href="/if/flow/${tenant.flowUnenrollment}"> | ||||||
|  |                                                 ${t`Delete account`} | ||||||
|  |                                             </a>`; | ||||||
|  |                                         } | ||||||
|  |                                         return html``; | ||||||
|  |                                     }))} | ||||||
|                                 </div> |                                 </div> | ||||||
|                             </div> |                             </div> | ||||||
|                         </div> |                         </div> | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer