瀏覽代碼

Fixed missing CredentialsCache refresh when saving Users in RPC environment

frogsoftware 1 年之前
父節點
當前提交
ec22a50b99

+ 1 - 0
InABox.Database/Stores/UserStore.cs

@@ -3,6 +3,7 @@ using InABox.Core;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net;
 using System.Text;
 using System.Threading.Tasks;
 

+ 1 - 1
InABox.Server/CredentialsCache.cs

@@ -133,7 +133,7 @@ namespace InABox.API
 
             if (IsBypassed(userId, password))
                 return BypassedUser;
-
+            
             EnsureCache(false);
             return _cache.FirstOrDefault(x => string.Equals(x.UserID, userId) && string.Equals(x.Password, password));
         }

+ 2 - 0
InABox.Server/RPC/Handlers/Delete.cs

@@ -27,6 +27,8 @@ namespace InABox.Rpc
                 items.Add(item);
             }
             store.Delete(items, parameters.AuditNote);
+            
+            InABox.API.CredentialsCache.Refresh(parameters.Type == typeof(InABox.Core.User));
 
             return new RpcDeleteResult();
         }

+ 4 - 1
InABox.Server/RPC/Handlers/Save.cs

@@ -1,3 +1,4 @@
+using System.Net;
 using InABox.API;
 using InABox.Core;
 using InABox.Database;
@@ -29,7 +30,9 @@ namespace InABox.Rpc
             var store = DbFactory.FindStore(parameters.Type, user.ID, user.UserID, session.Platform, session.Version ?? "");
 
             store.Save(entities, parameters.AuditNote);
-
+            
+            InABox.API.CredentialsCache.Refresh(parameters.Type == typeof(InABox.Core.User));
+            
             var deltas = new Dictionary<string, object?>[entities.Length];
             for (int i = 0; i < entities.Length; ++i)
             {