web/admin: fix user defaulting to 0 when not set in PolicyBindingForm

closes #2496

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-03-16 10:09:20 +01:00
parent f4955e3e62
commit 1f6af8c221

View file

@ -222,8 +222,8 @@ export class PolicyBindingForm extends ModelForm<PolicyBinding, string> {
.renderElement=${(group: Group): string => { .renderElement=${(group: Group): string => {
return group.name; return group.name;
}} }}
.value=${(group: Group | undefined): string => { .value=${(group: Group | undefined): string | undefined => {
return group ? group.pk : ""; return group ? group.pk : undefined;
}} }}
.selected=${(group: Group): boolean => { .selected=${(group: Group): boolean => {
return group.pk === this.instance?.group; return group.pk === this.instance?.group;
@ -256,8 +256,8 @@ export class PolicyBindingForm extends ModelForm<PolicyBinding, string> {
.renderElement=${(user: User): string => { .renderElement=${(user: User): string => {
return UserOption(user); return UserOption(user);
}} }}
.value=${(user: User | undefined): number => { .value=${(user: User | undefined): number | undefined => {
return user ? user.pk : 0; return user ? user.pk : undefined;
}} }}
.selected=${(user: User): boolean => { .selected=${(user: User): boolean => {
return user.pk === this.instance?.user; return user.pk === this.instance?.user;