diff --git a/plugins/view-resources/src/utils.ts b/plugins/view-resources/src/utils.ts index ab812cbdf1..e4b727bb42 100644 --- a/plugins/view-resources/src/utils.ts +++ b/plugins/view-resources/src/utils.ts @@ -1333,12 +1333,16 @@ async function getAttrEditor (key: KeyedAttribute, hierarchy: Hierarchy): Promis type PermissionsBySpace = Record, Set>> type AccountsByPermission = Record, Record, Set>>> -interface PermissionsStore { +export interface PermissionsStore { ps: PermissionsBySpace ap: AccountsByPermission whitelist: Set> } +export function checkMyPermission (_id: Ref, space: Ref, store: PermissionsStore): boolean { + return (store.whitelist.has(space) || store.ps[space]?.has(_id)) ?? false +} + export const permissionsStore = writable({ ps: {}, ap: {},