From fbd00bf5f8e7b370f6612e5cbbe44bcfe2e71e1f Mon Sep 17 00:00:00 2001
From: Jens Langhammer
Date: Tue, 14 Feb 2023 16:15:43 +0100
Subject: [PATCH] web/admin: remove groups and users from users and group form
to prevent accidental removal when updating
Signed-off-by: Jens Langhammer
---
web/src/admin/groups/GroupForm.ts | 65 ++-----------------------------
web/src/admin/users/UserForm.ts | 64 ++----------------------------
2 files changed, 6 insertions(+), 123 deletions(-)
diff --git a/web/src/admin/groups/GroupForm.ts b/web/src/admin/groups/GroupForm.ts
index 84fcc8b21..5a4024512 100644
--- a/web/src/admin/groups/GroupForm.ts
+++ b/web/src/admin/groups/GroupForm.ts
@@ -7,7 +7,6 @@ import "@goauthentik/elements/chips/ChipGroup";
import "@goauthentik/elements/forms/HorizontalFormElement";
import { ModelForm } from "@goauthentik/elements/forms/ModelForm";
import "@goauthentik/elements/forms/SearchSelect";
-import { UserOption } from "@goauthentik/elements/user/utils";
import YAML from "yaml";
import { t } from "@lingui/macro";
@@ -15,9 +14,8 @@ import { t } from "@lingui/macro";
import { CSSResult, TemplateResult, css, html } from "lit";
import { customElement } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js";
-import { until } from "lit/directives/until.js";
-import { CoreApi, CoreGroupsListRequest, Group, User } from "@goauthentik/api";
+import { CoreApi, CoreGroupsListRequest, Group } from "@goauthentik/api";
@customElement("ak-group-form")
export class GroupForm extends ModelForm {
@@ -48,9 +46,9 @@ export class GroupForm extends ModelForm {
send = (data: Group): Promise => {
if (this.instance?.pk) {
- return new CoreApi(DEFAULT_CONFIG).coreGroupsUpdate({
+ return new CoreApi(DEFAULT_CONFIG).coreGroupsPartialUpdate({
groupUuid: this.instance.pk,
- groupRequest: data,
+ patchedGroupRequest: data,
});
} else {
data.users = Array.from(this.instance?.users || []);
@@ -113,63 +111,6 @@ export class GroupForm extends ModelForm {
>
-
-
-
{
@@ -44,9 +43,9 @@ export class UserForm extends ModelForm {
send = (data: User): Promise => {
if (this.instance?.pk) {
- return new CoreApi(DEFAULT_CONFIG).coreUsersUpdate({
+ return new CoreApi(DEFAULT_CONFIG).coreUsersPartialUpdate({
id: this.instance.pk,
- userRequest: data,
+ patchedUserRequest: data,
});
} else {
return new CoreApi(DEFAULT_CONFIG).coreUsersCreate({
@@ -110,63 +109,6 @@ export class UserForm extends ModelForm {
${t`Designates whether this user should be treated as active. Unselect this instead of deleting accounts.`}
-
-
-