From f991d656c7132bfe05e155ed43da801d8483f1f3 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 17:02:26 +0200 Subject: [PATCH] web/admin: show user internal service account as disabled (cherry-pick #9464) (#9467) web/admin: show user internal service account as disabled (#9464) Signed-off-by: Jens Langhammer Co-authored-by: Jens L --- web/src/admin/users/UserForm.ts | 8 ++++++++ web/src/elements/forms/Radio.ts | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/web/src/admin/users/UserForm.ts b/web/src/admin/users/UserForm.ts index 061fd6f56a..f8b0b00e39 100644 --- a/web/src/admin/users/UserForm.ts +++ b/web/src/admin/users/UserForm.ts @@ -128,6 +128,14 @@ export class UserForm extends ModelForm { "Service accounts should be used for machine-to-machine authentication or other automations.", )}`, }, + { + label: "Internal Service account", + value: UserTypeEnum.InternalServiceAccount, + disabled: true, + description: html`${msg( + "Internal Service accounts are created and managed by authentik and cannot be created manually.", + )}`, + }, ]} .value=${this.instance?.type} > diff --git a/web/src/elements/forms/Radio.ts b/web/src/elements/forms/Radio.ts index 87e09b6f37..7730b87f77 100644 --- a/web/src/elements/forms/Radio.ts +++ b/web/src/elements/forms/Radio.ts @@ -16,6 +16,7 @@ export interface RadioOption { description?: TemplateResult; default?: boolean; value: T; + disabled?: boolean; } @customElement("ak-radio") @@ -77,6 +78,9 @@ export class Radio extends CustomEmitterElement(AKElement) { // This is a controlled input. Stop the native event from escaping or affecting the // value. We'll do that ourselves. ev.stopPropagation(); + if (option.disabled) { + return; + } this.value = option.value; this.dispatchCustomEvent("change", { value: option.value }); this.dispatchCustomEvent("input", { value: option.value }); @@ -93,6 +97,7 @@ export class Radio extends CustomEmitterElement(AKElement) { name="${this.name}" id=${elId} .checked=${option.value === this.value} + .disabled=${option.disabled} /> ${option.description