fix: live query role cache does not clear when a user is added to a role (#8026)

This commit is contained in:
dblythy
2022-06-11 18:21:55 +10:00
committed by GitHub
parent 0cd902b8c2
commit 199dfc1722
6 changed files with 108 additions and 2 deletions

View File

@@ -230,6 +230,15 @@ Auth.prototype.cacheRoles = function () {
return true;
};
Auth.prototype.clearRoleCache = function (sessionToken) {
if (!this.cacheController) {
return false;
}
this.cacheController.role.del(this.user.id);
this.cacheController.user.del(sessionToken);
return true;
};
Auth.prototype.getRolesByIds = async function (ins) {
const results = [];
// Build an OR query across all parentRoles