web/admin: clear other options depending on what the binding targets (#6703)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-08-30 21:15:36 +02:00 committed by GitHub
parent 6482a34af0
commit f8489387ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,6 +77,21 @@ export class PolicyBindingForm extends ModelForm<PolicyBinding, string> {
if (this.targetPk) { if (this.targetPk) {
data.target = 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) { if (this.instance?.pk) {
return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsUpdate({ return new PoliciesApi(DEFAULT_CONFIG).policiesBindingsUpdate({
policyBindingUuid: this.instance.pk, policyBindingUuid: this.instance.pk,