From 6fbe459903f91d92def742afd3b397b042807172 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Mon, 26 Feb 2024 14:54:59 -0500 Subject: [PATCH] refresh cache if user is updated --- .../EventSubscribers/CacheInvalidationEventSubscriber.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Oqtane.Server/Infrastructure/EventSubscribers/CacheInvalidationEventSubscriber.cs b/Oqtane.Server/Infrastructure/EventSubscribers/CacheInvalidationEventSubscriber.cs index 4c9ee85d..f143c122 100644 --- a/Oqtane.Server/Infrastructure/EventSubscribers/CacheInvalidationEventSubscriber.cs +++ b/Oqtane.Server/Infrastructure/EventSubscribers/CacheInvalidationEventSubscriber.cs @@ -21,8 +21,13 @@ namespace Oqtane.Infrastructure.EventSubscribers { _cache.Remove($"site:{syncEvent.TenantId}:{syncEvent.EntityId}*", true); } + // when user is modified (ie. roles) a a site reload event is raised and the site cache item for the user needs to be refreshed + if (syncEvent.EntityName == EntityNames.User && syncEvent.Action == SyncEventActions.Reload) + { + _cache.Remove($"site:{syncEvent.TenantId}:{syncEvent.SiteId}:{syncEvent.EntityId}", true); + } - // when a site entity is updated the hosting model may have changed, so the client assemblies cache items need to be refreshed + // when a site entity is updated, the hosting model may have changed so the client assemblies cache items need to be refreshed if (syncEvent.EntityName == EntityNames.Site && syncEvent.Action == SyncEventActions.Update) { _cache.Remove($"assemblieslist:{syncEvent.TenantId}:{syncEvent.EntityId}");