* main: (213 commits) website/docs: configuration: fix typo in kubectl command (#10492) website/integrations: fix typo in minio instructions (#10500) web: bump @typescript-eslint/eslint-plugin from 7.5.0 to 7.16.0 in /tests/wdio (#10496) website: bump prettier from 3.3.2 to 3.3.3 in /website (#10493) core: bump ruff from 0.5.1 to 0.5.2 (#10494) web: bump @typescript-eslint/parser from 7.5.0 to 7.16.0 in /tests/wdio (#10495) web: bump eslint-plugin-sonarjs from 0.25.1 to 1.0.3 in /tests/wdio (#10498) web: bump prettier from 3.3.2 to 3.3.3 in /tests/wdio (#10497) web: bump pseudolocale from 2.0.0 to 2.1.0 in /web (#10499) core: bump goauthentik.io/api/v3 from 3.2024061.1 to 3.2024061.2 (#10491) web: bump API Client version (#10488) flows: remove stage challenge type (#10476) core: bump github.com/redis/go-redis/v9 from 9.5.3 to 9.5.4 (#10469) core: bump goauthentik.io/api/v3 from 3.2024060.6 to 3.2024061.1 (#10470) web: bump the babel group across 1 directory with 2 updates (#10471) web: bump the storybook group across 1 directory with 7 updates (#10472) core: bump coverage from 7.5.4 to 7.6.0 (#10473) website/docs: air gapped: clarify .env usage at the top for Kubernetes installations (#10447) website/docs: air gapped: update "see configuration" wording (#10448) website/docs: Add Kubernetes Bootstrap Instructions (#9541) ...
183 lines
7.3 KiB
TypeScript
183 lines
7.3 KiB
TypeScript
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
|
import { docLink } from "@goauthentik/common/global";
|
|
import "@goauthentik/elements/CodeMirror";
|
|
import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror";
|
|
import "@goauthentik/elements/forms/FormGroup";
|
|
import "@goauthentik/elements/forms/HorizontalFormElement";
|
|
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
|
|
import "@goauthentik/elements/forms/Radio";
|
|
import type { RadioOption } from "@goauthentik/elements/forms/Radio";
|
|
|
|
import { msg } from "@lit/localize";
|
|
import { TemplateResult, html } from "lit";
|
|
import { customElement } from "lit/decorators.js";
|
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
|
|
import { PropertymappingsApi, RACPropertyMapping } from "@goauthentik/api";
|
|
|
|
export const staticSettingOptions: RadioOption<string | undefined>[] = [
|
|
{
|
|
label: msg("Unconfigured"),
|
|
value: undefined,
|
|
default: true,
|
|
description: html`${msg("This option will not be changed by this mapping.")}`,
|
|
},
|
|
{
|
|
label: msg("Enabled"),
|
|
value: "true",
|
|
},
|
|
{
|
|
label: msg("Disabled"),
|
|
value: "false",
|
|
},
|
|
];
|
|
|
|
@customElement("ak-property-mapping-rac-form")
|
|
export class PropertyMappingLDAPForm extends ModelForm<RACPropertyMapping, string> {
|
|
loadInstance(pk: string): Promise<RACPropertyMapping> {
|
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsRacRetrieve({
|
|
pmUuid: pk,
|
|
});
|
|
}
|
|
|
|
getSuccessMessage(): string {
|
|
if (this.instance) {
|
|
return msg("Successfully updated mapping.");
|
|
} else {
|
|
return msg("Successfully created mapping.");
|
|
}
|
|
}
|
|
|
|
async send(data: RACPropertyMapping): Promise<RACPropertyMapping> {
|
|
if (this.instance) {
|
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsRacUpdate({
|
|
pmUuid: this.instance.pk,
|
|
rACPropertyMappingRequest: data,
|
|
});
|
|
} else {
|
|
return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsRacCreate({
|
|
rACPropertyMappingRequest: data,
|
|
});
|
|
}
|
|
}
|
|
|
|
renderForm(): TemplateResult {
|
|
return html`
|
|
<ak-form-element-horizontal label=${msg("Name")} ?required=${true} name="name">
|
|
<input
|
|
type="text"
|
|
value="${ifDefined(this.instance?.name)}"
|
|
class="pf-c-form-control"
|
|
required
|
|
/>
|
|
</ak-form-element-horizontal>
|
|
<ak-form-group .expanded=${true}>
|
|
<span slot="header"> ${msg("General settings")} </span>
|
|
<div slot="body" class="pf-c-form">
|
|
<ak-form-element-horizontal
|
|
label=${msg("Username")}
|
|
name="staticSettings.username"
|
|
>
|
|
<input
|
|
type="text"
|
|
value="${ifDefined(this.instance?.staticSettings.username)}"
|
|
class="pf-c-form-control"
|
|
required
|
|
/>
|
|
</ak-form-element-horizontal>
|
|
<ak-form-element-horizontal
|
|
label=${msg("Password")}
|
|
name="staticSettings.password"
|
|
>
|
|
<input
|
|
type="password"
|
|
value="${ifDefined(this.instance?.staticSettings.password)}"
|
|
class="pf-c-form-control"
|
|
required
|
|
/>
|
|
</ak-form-element-horizontal>
|
|
</div>
|
|
</ak-form-group>
|
|
<ak-form-group>
|
|
<span slot="header"> ${msg("RDP settings")} </span>
|
|
<div slot="body" class="pf-c-form">
|
|
<ak-form-element-horizontal
|
|
label=${msg("Ignore server certificate")}
|
|
name="staticSettings.ignore-cert"
|
|
>
|
|
<ak-radio
|
|
.options=${staticSettingOptions}
|
|
.value=${this.instance?.staticSettings["ignore-cert"]}
|
|
>
|
|
</ak-radio>
|
|
</ak-form-element-horizontal>
|
|
<ak-form-element-horizontal
|
|
label=${msg("Enable wallpaper")}
|
|
name="staticSettings.enable-wallpaper"
|
|
>
|
|
<ak-radio
|
|
.options=${staticSettingOptions}
|
|
.value=${this.instance?.staticSettings["enable-wallpaper"]}
|
|
>
|
|
</ak-radio>
|
|
</ak-form-element-horizontal>
|
|
<ak-form-element-horizontal
|
|
label=${msg("Enable font-smoothing")}
|
|
name="staticSettings.enable-font-smoothing"
|
|
>
|
|
<ak-radio
|
|
.options=${staticSettingOptions}
|
|
.value=${this.instance?.staticSettings["enable-font-smoothing"]}
|
|
>
|
|
</ak-radio>
|
|
</ak-form-element-horizontal>
|
|
<ak-form-element-horizontal
|
|
label=${msg("Enable full window dragging")}
|
|
name="staticSettings.enable-full-window-drag"
|
|
>
|
|
<ak-radio
|
|
.options=${staticSettingOptions}
|
|
.value=${this.instance?.staticSettings["enable-full-window-drag"]}
|
|
>
|
|
</ak-radio>
|
|
</ak-form-element-horizontal>
|
|
</div>
|
|
</ak-form-group>
|
|
<ak-form-group>
|
|
<span slot="header"> ${msg("Advanced settings")} </span>
|
|
<div slot="body" class="pf-c-form">
|
|
<ak-form-element-horizontal
|
|
label=${msg("Expression")}
|
|
?required=${true}
|
|
name="expression"
|
|
>
|
|
<ak-codemirror
|
|
mode=${CodeMirrorMode.Python}
|
|
value="${ifDefined(this.instance?.expression)}"
|
|
>
|
|
</ak-codemirror>
|
|
<p class="pf-c-form__helper-text">
|
|
${msg("Expression using Python.")}
|
|
<a
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href="${docLink(
|
|
"/docs/property-mappings/expression?utm_source=authentik",
|
|
)}"
|
|
>
|
|
${msg("See documentation for a list of all variables.")}
|
|
</a>
|
|
</p>
|
|
</ak-form-element-horizontal>
|
|
</div>
|
|
</ak-form-group>
|
|
`;
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
"ak-property-mapping-rac-form": PropertyMappingLDAPForm;
|
|
}
|
|
}
|