stages/user_write: add option to add newly created users to a group

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-09-14 21:45:34 +02:00
parent 198e5ce642
commit ef341dd405
10 changed files with 106 additions and 5 deletions

View File

@ -1888,6 +1888,7 @@ msgstr "Go to previous page"
#: src/pages/policies/PolicyBindingForm.ts
#: src/pages/policies/PolicyBindingForm.ts
#: src/pages/providers/ldap/LDAPProviderForm.ts
#: src/pages/stages/user_write/UserWriteStageForm.ts
msgid "Group"
msgstr "Group"
@ -2371,6 +2372,7 @@ msgstr "Loading"
#: src/pages/stages/password/PasswordStageForm.ts
#: src/pages/stages/prompt/PromptStageForm.ts
#: src/pages/stages/prompt/PromptStageForm.ts
#: src/pages/stages/user_write/UserWriteStageForm.ts
#: src/pages/tenants/TenantForm.ts
#: src/pages/tenants/TenantForm.ts
#: src/pages/tenants/TenantForm.ts
@ -2644,6 +2646,10 @@ msgstr "Negates the outcome of the binding. Messages are unaffected."
msgid "New version available!"
msgstr "New version available!"
#: src/pages/stages/user_write/UserWriteStageForm.ts
msgid "Newly created users are added to this group, if a group is selected."
msgstr "Newly created users are added to this group, if a group is selected."
#: src/elements/oauth/UserRefreshList.ts
#: src/pages/applications/ApplicationCheckAccessForm.ts
#: src/pages/crypto/CertificateKeyPairListPage.ts

View File

@ -1880,6 +1880,7 @@ msgstr ""
#: src/pages/policies/PolicyBindingForm.ts
#: src/pages/policies/PolicyBindingForm.ts
#: src/pages/providers/ldap/LDAPProviderForm.ts
#: src/pages/stages/user_write/UserWriteStageForm.ts
msgid "Group"
msgstr ""
@ -2363,6 +2364,7 @@ msgstr ""
#: src/pages/stages/password/PasswordStageForm.ts
#: src/pages/stages/prompt/PromptStageForm.ts
#: src/pages/stages/prompt/PromptStageForm.ts
#: src/pages/stages/user_write/UserWriteStageForm.ts
#: src/pages/tenants/TenantForm.ts
#: src/pages/tenants/TenantForm.ts
#: src/pages/tenants/TenantForm.ts
@ -2636,6 +2638,10 @@ msgstr ""
msgid "New version available!"
msgstr ""
#: src/pages/stages/user_write/UserWriteStageForm.ts
msgid "Newly created users are added to this group, if a group is selected."
msgstr ""
#: src/elements/oauth/UserRefreshList.ts
#: src/pages/applications/ApplicationCheckAccessForm.ts
#: src/pages/crypto/CertificateKeyPairListPage.ts

View File

@ -1,4 +1,4 @@
import { UserWriteStage, StagesApi } from "@goauthentik/api";
import { UserWriteStage, StagesApi, CoreApi } from "@goauthentik/api";
import { t } from "@lingui/macro";
import { customElement } from "lit-element";
import { html, TemplateResult } from "lit-html";
@ -8,6 +8,7 @@ import "../../../elements/forms/HorizontalFormElement";
import "../../../elements/forms/FormGroup";
import { ModelForm } from "../../../elements/forms/ModelForm";
import { first } from "../../../utils";
import { until } from "lit-html/directives/until";
@customElement("ak-stage-user-write-form")
export class UserWriteStageForm extends ModelForm<UserWriteStage, string> {
@ -70,6 +71,33 @@ export class UserWriteStageForm extends ModelForm<UserWriteStage, string> {
${t`Mark newly created users as inactive.`}
</p>
</ak-form-element-horizontal>
<ak-form-element-horizontal label=${t`Group`} name="searchGroup">
<select class="pf-c-form-control">
<option
value=""
?selected=${this.instance?.createUsersGroup === undefined}
>
---------
</option>
${until(
new CoreApi(DEFAULT_CONFIG).coreGroupsList({}).then((groups) => {
return groups.results.map((group) => {
return html`<option
value=${ifDefined(group.pk)}
?selected=${this.instance?.createUsersGroup ===
group.pk}
>
${group.name}
</option>`;
});
}),
html`<option>${t`Loading...`}</option>`,
)}
</select>
<p class="pf-c-form__helper-text">
${t`Newly created users are added to this group, if a group is selected.`}
</p>
</ak-form-element-horizontal>
</div>
</ak-form-group>
</form>`;