Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion adminforth/modules/restApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' };
Expand All @@ -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) => [
Expand Down