Browse Source

fix: wipe base user list cache on new user

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/7202/head
mertmit 1 year ago
parent
commit
32e66b3266
  1. 12
      packages/nocodb/src/models/User.ts

12
packages/nocodb/src/models/User.ts

@ -9,7 +9,7 @@ import {
CacheScope,
MetaTable,
} from '~/utils/globals';
import { BaseUser } from '~/models';
import { Base, BaseUser } from '~/models';
import { sanitiseUserObj } from '~/utils';
export default class User implements UserType {
@ -71,6 +71,16 @@ export default class User implements UserType {
await NocoCache.del(CacheScope.INSTANCE_META);
// clear all base user related cache for instance
const bases = await Base.list({}, ncMeta);
for (const base of bases) {
await NocoCache.deepDel(
CacheScope.BASE_USER,
`${CacheScope.BASE_USER}:${base.id}:list`,
CacheDelDirection.PARENT_TO_CHILD,
);
}
return this.get(id, ncMeta);
}

Loading…
Cancel
Save