Browse Source

fix: filter tables based on acl

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6318/head
Pranav C 1 year ago
parent
commit
31de86cbc8
  1. 2
      packages/nocodb/src/controllers/tables.controller.ts
  2. 4
      packages/nocodb/src/services/tables.service.ts

2
packages/nocodb/src/controllers/tables.controller.ts

@ -38,7 +38,7 @@ export class TablesController {
projectId,
baseId,
includeM2M: includeM2M === 'true',
roles: extractRolesObj(req.user.roles),
roles: extractRolesObj(req.user.project_roles),
}),
);
}

4
packages/nocodb/src/services/tables.service.ts

@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import DOMPurify from 'isomorphic-dompurify';
import { isLinksOrLTAR, isVirtualCol, ModelTypes, UITypes } from 'nocodb-sdk';
import { isLinksOrLTAR, isVirtualCol, ModelTypes, ProjectRoles, UITypes } from 'nocodb-sdk'
import { AppEvents } from 'nocodb-sdk';
import { MetaDiffsService } from './meta-diffs.service';
import { ColumnsService } from './columns.service';
@ -328,7 +328,7 @@ export class TablesService {
const tableViewMapping = viewList.reduce((o, view: any) => {
o[view.fk_model_id] = o[view.fk_model_id] || 0;
if (
Object.keys(param.roles).some(
Object.values(ProjectRoles).some(
(role) => param.roles[role] && !view.disabled[role],
)
) {

Loading…
Cancel
Save