import { LDAPPropertyMapping, PropertymappingsApi } from "authentik-api"; import { t } from "@lingui/macro"; import { customElement, property } from "lit-element"; import { html, TemplateResult } from "lit-html"; import { DEFAULT_CONFIG } from "../../api/Config"; import { Form } from "../../elements/forms/Form"; import { ifDefined } from "lit-html/directives/if-defined"; import "../../elements/forms/HorizontalFormElement"; import "../../elements/CodeMirror"; @customElement("ak-property-mapping-ldap-form") export class PropertyMappingLDAPForm extends Form { set mappingUUID(value: string) { new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapRead({ pmUuid: value, }).then(mapping => { this.mapping = mapping; }); } @property({attribute: false}) mapping?: LDAPPropertyMapping; getSuccessMessage(): string { if (this.mapping) { return t`Successfully updated mapping.`; } else { return t`Successfully created mapping.`; } } send = (data: LDAPPropertyMapping): Promise => { if (this.mapping) { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapUpdate({ pmUuid: this.mapping.pk || "", data: data }); } else { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsLdapCreate({ data: data }); } }; renderForm(): TemplateResult { return html`

${t`Field of the user object this value is written to.`}

Expression using Python. See here for a list of all variables.

`; } }