diff --git a/adminforth/modules/restApi.ts b/adminforth/modules/restApi.ts index cd8a0da60..95e82e0e5 100644 --- a/adminforth/modules/restApi.ts +++ b/adminforth/modules/restApi.ts @@ -2046,7 +2046,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI { }, request_schema: getMinMaxForColumnsRequestSchema, response_schema: getMinMaxForColumnsResponseSchema, - handler: async ({ body }) => { + handler: async ({ body, adminUser }) => { const { resourceId } = body; if (!this.adminforth.statuses.dbDiscover) { return { error: 'Database discovery not started' }; @@ -2058,6 +2058,17 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI { if (!resource) { return { error: `Resource '${resourceId}' not found` }; } + const { allowedActions } = await interpretResource( + adminUser, + resource, + { requestBody: body, pk: undefined }, + ActionCheckSource.ListRequest, + this.adminforth + ); + const { allowed, error } = checkAccess(AllowedActionsEnum.list, allowedActions); + if (!allowed) { + return { error }; + } const item = await this.adminforth.connectors[resource.dataSource].getMinMaxForColumns({ resource, columns: resource.columns.filter((col) => [