Browse Source

fix: use ws role for cmdk if no base role

nc-fix/cmdk-ws-2
mertmit 2 months ago
parent
commit
1b4b17e7d9
  1. 3
      packages/nocodb/src/helpers/commandPaletteHelpers.ts
  2. 6
      packages/nocodb/src/services/command-palette.service.ts

3
packages/nocodb/src/helpers/commandPaletteHelpers.ts

@ -1,3 +1,4 @@
import { ProjectRoles } from 'nocodb-sdk';
import { CacheGetType, CacheScope, MetaTable } from '~/utils/globals';
import Noco from '~/Noco';
import NocoCache from '~/cache/NocoCache';
@ -45,7 +46,7 @@ export async function getCommandPaletteForUserWorkspace(
);
})
.where('bu.fk_user_id', userId)
.andWhereNot('bu.roles', 'no_access')
.andWhereNot('bu.roles', ProjectRoles.NO_ACCESS)
.andWhere('t.mm', false)
.andWhere(function () {
this.where('dm.disabled', false).orWhereNull('dm.disabled');

6
packages/nocodb/src/services/command-palette.service.ts

@ -1,4 +1,4 @@
import { Injectable } from '@nestjs/common';
import { Injectable, Logger } from '@nestjs/common';
import { type UserType, ViewTypes } from 'nocodb-sdk';
import { deserializeJSON } from '~/utils/serialize';
import { getCommandPaletteForUserWorkspace } from '~/helpers/commandPaletteHelpers';
@ -14,7 +14,7 @@ const viewTypeAlias: Record<number, string> = {
@Injectable()
export class CommandPaletteService {
constructor() {}
logger = new Logger('CommandPaletteService');
async commandPalette(param: { body: any; user: UserType }) {
const cmdData = [];
@ -137,7 +137,7 @@ export class CommandPaletteService {
});
}
} catch (e) {
console.log(e);
this.logger.warn(e);
return [];
}
return cmdData;

Loading…
Cancel
Save