diff --git a/web/src/admin/events/RuleForm.ts b/web/src/admin/events/RuleForm.ts index 294520779..c7e2e6e2e 100644 --- a/web/src/admin/events/RuleForm.ts +++ b/web/src/admin/events/RuleForm.ts @@ -1,4 +1,5 @@ import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; +import "@goauthentik/elements/SearchSelect"; import "@goauthentik/elements/forms/HorizontalFormElement"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; @@ -9,7 +10,14 @@ import { customElement } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { until } from "lit/directives/until.js"; -import { CoreApi, EventsApi, NotificationRule, SeverityEnum } from "@goauthentik/api"; +import { + CoreApi, + CoreGroupsListRequest, + EventsApi, + Group, + NotificationRule, + SeverityEnum, +} from "@goauthentik/api"; @customElement("ak-event-rule-form") export class RuleForm extends ModelForm { @@ -74,24 +82,29 @@ export class RuleForm extends ModelForm { /> - + => { + const args: CoreGroupsListRequest = { + ordering: "name", + }; + if (query !== undefined) { + args.search = query; + } + const groups = await new CoreApi(DEFAULT_CONFIG).coreGroupsList(args); + return groups.results; + }} + .renderElement=${(group: Group): string => { + return group.name; + }} + .value=${(group: Group | undefined): string | undefined => { + return group?.pk; + }} + .selected=${(group: Group): boolean => { + return group.pk === this.instance?.group; + }} + ?blankable=${true} + > + - - ${until( - new CoreApi(DEFAULT_CONFIG).coreGroupsList({}).then((groups) => { - return groups.results.map((group) => { - return html``; - }); - }), - html``, - )} - + => { + const args: CoreGroupsListRequest = { + ordering: "name", + }; + if (query !== undefined) { + args.search = query; + } + const groups = await new CoreApi(DEFAULT_CONFIG).coreGroupsList(args); + return groups.results; + }} + .renderElement=${(group: Group): string => { + return group.name; + }} + .value=${(group: Group | undefined): string | undefined => { + return group?.pk; + }} + .selected=${(group: Group): boolean => { + return group.pk === this.instance?.parent; + }} + ?blankable=${true} + > +
diff --git a/web/src/admin/providers/ldap/LDAPProviderForm.ts b/web/src/admin/providers/ldap/LDAPProviderForm.ts index 21ac5f7b9..c1e4d5629 100644 --- a/web/src/admin/providers/ldap/LDAPProviderForm.ts +++ b/web/src/admin/providers/ldap/LDAPProviderForm.ts @@ -1,5 +1,6 @@ import { DEFAULT_CONFIG, tenant } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; +import "@goauthentik/elements/SearchSelect"; import "@goauthentik/elements/forms/FormGroup"; import "@goauthentik/elements/forms/HorizontalFormElement"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; @@ -13,9 +14,11 @@ import { until } from "lit/directives/until.js"; import { CoreApi, + CoreGroupsListRequest, CryptoApi, FlowsApi, FlowsInstancesListDesignationEnum, + Group, LDAPAPIAccessMode, LDAPProvider, ProvidersApi, @@ -97,24 +100,29 @@ export class LDAPProviderFormPage extends ModelForm {

- + => { + const args: CoreGroupsListRequest = { + ordering: "name", + }; + if (query !== undefined) { + args.search = query; + } + const groups = await new CoreApi(DEFAULT_CONFIG).coreGroupsList(args); + return groups.results; + }} + .renderElement=${(group: Group): string => { + return group.name; + }} + .value=${(group: Group | undefined): string | undefined => { + return group?.pk; + }} + .selected=${(group: Group): boolean => { + return group.pk === this.instance?.searchGroup; + }} + ?blankable=${true} + > +

${t`Users in the selected group can do search queries. If no group is selected, no LDAP Searches are allowed.`}

diff --git a/web/src/admin/sources/ldap/LDAPSourceForm.ts b/web/src/admin/sources/ldap/LDAPSourceForm.ts index 30970b244..f83d9d26e 100644 --- a/web/src/admin/sources/ldap/LDAPSourceForm.ts +++ b/web/src/admin/sources/ldap/LDAPSourceForm.ts @@ -310,7 +310,6 @@ export class LDAPSourceForm extends ModelForm { ${t`Additional settings`}
- => { const args: CoreGroupsListRequest = {