From f8489387ee179cef959618d123faa65b2874a270 Mon Sep 17 00:00:00 2001 From: Jens L Date: Wed, 30 Aug 2023 21:15:36 +0200 Subject: [PATCH] web/admin: clear other options depending on what the binding targets (#6703) Signed-off-by: Jens Langhammer --- web/src/admin/policies/PolicyBindingForm.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web/src/admin/policies/PolicyBindingForm.ts b/web/src/admin/policies/PolicyBindingForm.ts index a69638a43..458210edf 100644 --- a/web/src/admin/policies/PolicyBindingForm.ts +++ b/web/src/admin/policies/PolicyBindingForm.ts @@ -77,6 +77,21 @@ export class PolicyBindingForm extends ModelForm { if (this.targetPk) { data.target = this.targetPk; } + switch (this.policyGroupUser) { + case target.policy: + data.user = null; + data.group = null; + break; + case target.group: + data.policy = null; + data.user = null; + break; + case target.user: + data.policy = null; + data.group = null; + break; + } + console.log(data); if (this.instance?.pk) { return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsUpdate({ policyBindingUuid: this.instance.pk,