import { LDAPSource, SourcesApi, PropertymappingsApi } from "authentik-api"; import { gettext } from "django"; 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"; @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 gettext("Successfully updated source."); } else { return gettext("Successfully created source."); } } send = (data: LDAPSource): Promise => { if (this.source) { return new SourcesApi(DEFAULT_CONFIG).sourcesLdapUpdate({ slug: this.source.slug, data: data }); } else { return new SourcesApi(DEFAULT_CONFIG).sourcesLdapCreate({ data: data }); } }; renderForm(): TemplateResult { return html`
${gettext("Connection settings")}
${gettext("Advanced settings")}

${gettext("Property mappings used to user creation.")}

${gettext("Hold control/command to select multiple items.")}

${gettext("Property mappings used to group creation.")}

${gettext("Hold control/command to select multiple items.")}

${gettext("Additional user DN, prepended to the Base DN.")}

${gettext("Additional group DN, prepended to the Base DN.")}

${gettext("Consider Objects matching this filter to be Users.")}

${gettext("Consider Objects matching this filter to be Groups.")}

${gettext("Field which contains members of a group.")}

${gettext("Field which contains a unique Identifier.")}

`; } }