Browse Source

chore(gui-v2): properly type rolePermission and remove unnecessary check

pull/2940/head
braks 2 years ago
parent
commit
9820ed6a20
  1. 4
      packages/nc-gui-v2/composables/useUIPermission/index.ts

4
packages/nc-gui-v2/composables/useUIPermission/index.ts

@ -33,9 +33,9 @@ export function useUIPermission() {
// }
return Object.entries<boolean>(roles).some(([role, hasRole]) => {
const rolePermission = rolePermissions[role as keyof typeof rolePermissions] as Permission
const rolePermission = rolePermissions[role as keyof typeof rolePermissions] as '*' | Record<Permission, true>
return hasRole && (rolePermission === '*' || (typeof rolePermission === 'object' && rolePermission[permission]))
return hasRole && (rolePermission === '*' || rolePermission[permission])
})
}

Loading…
Cancel
Save