web/admin: fix ApplicationView's CheckAccess not sending UserID correctly

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-07-25 21:03:32 +02:00
parent 3c9cc9d421
commit 0587ab26e8

View file

@ -8,7 +8,7 @@ import { until } from "lit-html/directives/until";
import "../../elements/forms/HorizontalFormElement"; import "../../elements/forms/HorizontalFormElement";
@customElement("ak-application-check-access-form") @customElement("ak-application-check-access-form")
export class ApplicationCheckAccessForm extends Form<number> { export class ApplicationCheckAccessForm extends Form<{ forUser: number }> {
@property({attribute: false}) @property({attribute: false})
application!: Application; application!: Application;
@ -23,14 +23,19 @@ export class ApplicationCheckAccessForm extends Form<number> {
return t`Successfully sent test-request.`; return t`Successfully sent test-request.`;
} }
send = (data: number): Promise<PolicyTestResult> => { send = (data: { forUser: number }): Promise<PolicyTestResult> => {
this.request = data; this.request = data.forUser;
return new CoreApi(DEFAULT_CONFIG).coreApplicationsCheckAccessRetrieve({ return new CoreApi(DEFAULT_CONFIG).coreApplicationsCheckAccessRetrieve({
slug: this.application?.slug, slug: this.application?.slug,
forUser: data, forUser: data.forUser,
}).then(result => this.result = result); }).then(result => this.result = result);
}; };
resetForm(): void {
super.resetForm();
this.result = undefined;
}
renderResult(): TemplateResult { renderResult(): TemplateResult {
return html` return html`
<ak-form-element-horizontal <ak-form-element-horizontal