import { LDAPSource, SourcesApi, 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 "../../../elements/forms/FormGroup"; import "../../../elements/forms/HorizontalFormElement"; import { ifDefined } from "lit-html/directives/if-defined"; import { until } from "lit-html/directives/until"; import { first } from "../../../utils"; @customElement("ak-source-ldap-form") export class LDAPSourceForm extends Form { set sourceSlug(value: string) { new SourcesApi(DEFAULT_CONFIG).sourcesLdapRead({ slug: value, }).then(source => { this.source = source; }); } @property({attribute: false}) source?: LDAPSource; getSuccessMessage(): string { if (this.source) { return t`Successfully updated source.`; } else { return t`Successfully created source.`; } } send = (data: LDAPSource): Promise => { if (this.source) { return new SourcesApi(DEFAULT_CONFIG).sourcesLdapPartialUpdate({ slug: this.source.slug, data: data }); } else { return new SourcesApi(DEFAULT_CONFIG).sourcesLdapCreate({ data: data }); } }; renderForm(): TemplateResult { return html`
${t`Connection settings`}
${t`Advanced settings`}

${t`Property mappings used to user creation.`}

${t`Hold control/command to select multiple items.`}

${t`Property mappings used to group creation.`}

${t`Hold control/command to select multiple items.`}

${t`Additional user DN, prepended to the Base DN.`}

${t`Additional group DN, prepended to the Base DN.`}

${t`Consider Objects matching this filter to be Users.`}

${t`Consider Objects matching this filter to be Groups.`}

${t`Field which contains members of a group.`}

${t`Field which contains a unique Identifier.`}

`; } }