Browse Source

fix: missing ncMeta for clear user cache

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/7202/head
mertmit 9 months ago
parent
commit
0d2b3d8c92
  1. 10
      packages/nocodb/src/models/User.ts

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

@ -114,7 +114,7 @@ export default class User implements UserType {
await ncMeta.metaUpdate(null, null, MetaTable.USERS, updateObj, id);
// clear all user related cache
await this.clearCache(id);
await this.clearCache(id, ncMeta);
return this.get(id, ncMeta);
}
@ -232,7 +232,7 @@ export default class User implements UserType {
if (!user) NcError.badRequest('User not found');
// clear all user related cache
await this.clearCache(userId);
await this.clearCache(userId, ncMeta);
return await ncMeta.metaDelete(null, null, MetaTable.USERS, userId);
}
@ -273,11 +273,11 @@ export default class User implements UserType {
} as any;
}
protected static async clearCache(userId: string) {
const user = await this.get(userId);
protected static async clearCache(userId: string, ncMeta = Noco.ncMeta) {
const user = await this.get(userId, ncMeta);
if (!user) NcError.badRequest('User not found');
const bases = await BaseUser.getProjectsList(userId, {});
const bases = await BaseUser.getProjectsList(userId, {}, ncMeta);
for (const base of bases) {
await NocoCache.deepDel(

Loading…
Cancel
Save