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 <jens@goauthentik.io>
Co-authored-by: Jens L <jens@goauthentik.io>
This commit is contained in:
gcp-cherry-pick-bot[bot]
2024-04-26 17:02:26 +02:00
committed by GitHub
parent e86aa11131
commit f991d656c7
2 changed files with 13 additions and 0 deletions

View File

@ -128,6 +128,14 @@ export class UserForm extends ModelForm<User, number> {
"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}
>

View File

@ -16,6 +16,7 @@ export interface RadioOption<T> {
description?: TemplateResult;
default?: boolean;
value: T;
disabled?: boolean;
}
@customElement("ak-radio")
@ -77,6 +78,9 @@ export class Radio<T> 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<T> extends CustomEmitterElement(AKElement) {
name="${this.name}"
id=${elId}
.checked=${option.value === this.value}
.disabled=${option.disabled}
/>
<label class="pf-c-radio__label" for=${elId}>${option.label}</label>
${option.description