Browse Source

fix: cache acl entry on insert

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6318/head
Pranav C 1 year ago
parent
commit
a310faac4d
  1. 10
      packages/nocodb/src/models/ModelRoleVisibility.ts

10
packages/nocodb/src/models/ModelRoleVisibility.ts

@ -147,17 +147,23 @@ export default class ModelRoleVisibility implements ModelRoleVisibilityType {
insertObj.base_id = view.base_id; insertObj.base_id = view.base_id;
} }
await ncMeta.metaInsert2( const result = await ncMeta.metaInsert2(
null, null,
null, null,
MetaTable.MODEL_ROLE_VISIBILITY, MetaTable.MODEL_ROLE_VISIBILITY,
insertObj, insertObj,
); );
const key = `${CacheScope.MODEL_ROLE_VISIBILITY}:${body.fk_view_id}:${body.role}`;
insertObj.id = result.id;
await NocoCache.set(key, insertObj);
await NocoCache.appendToList( await NocoCache.appendToList(
CacheScope.MODEL_ROLE_VISIBILITY, CacheScope.MODEL_ROLE_VISIBILITY,
[insertObj.project_id], [insertObj.project_id],
`${CacheScope.MODEL_ROLE_VISIBILITY}:${body.fk_view_id}:${body.role}`, key,
); );
return this.get( return this.get(

Loading…
Cancel
Save