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
1 changed files with 9 additions and 4 deletions

View File

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