Browse Source

fix: null check for role power functions

pull/6388/head
mertmit 1 year ago
parent
commit
fa796e4ea2
  1. 4
      packages/nocodb/src/utils/roleHelper.ts

4
packages/nocodb/src/utils/roleHelper.ts

@ -5,6 +5,10 @@ import type { ProjectRoles } from 'nocodb-sdk';
export function getProjectRolePower(user: any) { export function getProjectRolePower(user: any) {
const reverseOrderedProjectRoles = [...OrderedProjectRoles].reverse(); const reverseOrderedProjectRoles = [...OrderedProjectRoles].reverse();
if (!user.project_roles) {
NcError.badRequest('Role not found');
}
// get most powerful role of user (TODO moving forward we will confirm that user has only one role) // get most powerful role of user (TODO moving forward we will confirm that user has only one role)
let role = null; let role = null;
let power = -1; let power = -1;

Loading…
Cancel
Save