Browse Source

fix: correction in project id validation

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5901/head
Pranav C 2 years ago
parent
commit
a419e11525
  1. 4
      packages/nocodb/src/controllers/data-table.controller.ts
  2. 7
      packages/nocodb/src/services/data-table.service.ts

4
packages/nocodb/src/controllers/data-table.controller.ts

@ -106,13 +106,11 @@ export class DataTableController {
@Acl('dataDelete')
async dataDelete(
@Request() req,
@Param('projectId') projectId: string,
@Param('modelId') modelId: string,
@Query('viewId') viewId: string,
@Param('rowId') rowId: string,
) {
return await this.dataTableService.dataDelete({
projectId: projectId,
modelId: modelId,
cookie: req,
viewId,
@ -124,14 +122,12 @@ export class DataTableController {
@Acl('dataRead')
async dataRead(
@Request() req,
@Param('projectId') projectId: string,
@Param('modelId') modelId: string,
@Query('viewId') viewId: string,
@Param('rowId') rowId: string,
) {
return await this.dataTableService.dataRead({
modelId,
projectId,
rowId: rowId,
query: req.query,
viewId,

7
packages/nocodb/src/services/data-table.service.ts

@ -143,8 +143,6 @@ export class DataTableService {
return { count };
}
private async getModelAndView(param: {
projectId?: string;
viewId?: string;
@ -152,11 +150,11 @@ export class DataTableService {
}) {
const model = await Model.get(param.modelId);
if(!model) {
if (!model) {
throw new Error('Model not found');
}
if (model.project_id && model.project_id !== param.projectId) {
if (param.projectId && model.project_id !== param.projectId) {
throw new Error('Model not belong to project');
}
@ -171,5 +169,4 @@ export class DataTableService {
return { model, view };
}
}

Loading…
Cancel
Save