import { LDAPSource, SourcesApi, PropertymappingsApi, LDAPSourceRequest } from "authentik-api"; import { t } from "@lingui/macro"; import { customElement } from "lit-element"; import { html, TemplateResult } from "lit-html"; import { DEFAULT_CONFIG } from "../../../api/Config"; 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"; import { ModelForm } from "../../../elements/forms/ModelForm"; @customElement("ak-source-ldap-form") export class LDAPSourceForm extends ModelForm { loadInstance(pk: string): Promise { return new SourcesApi(DEFAULT_CONFIG).sourcesLdapRetrieve({ slug: pk, }); } getSuccessMessage(): string { if (this.instance) { return t`Successfully updated source.`; } else { return t`Successfully created source.`; } } send = (data: LDAPSource): Promise => { if (this.instance) { return new SourcesApi(DEFAULT_CONFIG).sourcesLdapPartialUpdate({ slug: this.instance.slug, patchedLDAPSourceRequest: data }); } else { return new SourcesApi(DEFAULT_CONFIG).sourcesLdapCreate({ lDAPSourceRequest: data as unknown as LDAPSourceRequest }); } }; renderForm(): TemplateResult { return html`

${t`Login password is synced from LDAP into authentik automatically. Enable this option only to write password changes in authentik back to LDAP.`}

${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.`}

`; } }