The Free Software Media System - Server Backend & API
Hook new registration load to changing supporter keys
Eric Reeda7f06c84b14e
diff --git a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.csindex beca1637de..c345e122f3 100644--- a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs+++ b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs@@ -73,9 +73,9 @@ namespace MediaBrowser.Common.Implementations.Security{var tasks = new List<Task>();+ ResetSupporterInfo();tasks.AddRange(_registeredEntities.Select(i => i.LoadRegistrationInfoAsync()));await Task.WhenAll(tasks);- ResetSupporterInfo();}/// <summary>@@ -101,11 +101,8 @@ namespace MediaBrowser.Common.Implementations.Securityif (value != MBRegistration.SupporterKey){MBRegistration.SupporterKey = value;- // Clear this so it will re-evaluate- ResetSupporterInfo();- // And we'll need to restart to re-evaluate the status of plug-ins- _appHost.NotifyPendingRestart();-+ // re-load registration info+ Task.Run(() => LoadAllRegistrationInfo());}}}@@ -119,9 +116,12 @@ namespace MediaBrowser.Common.Implementations.Securityget { return MBRegistration.LegacyKey; }set{- MBRegistration.LegacyKey = value;- // And we'll need to restart to re-evaluate the status of plug-ins- _appHost.NotifyPendingRestart();+ if (value != MBRegistration.LegacyKey)+ {+ MBRegistration.LegacyKey = value;+ // re-load registration info+ Task.Run(() => LoadAllRegistrationInfo());+ }}}diff --git a/MediaBrowser.Common/Security/IRequiresRegistration.cs b/MediaBrowser.Common/Security/IRequiresRegistration.csindex 66667d449b..7b1667c2e2 100644--- a/MediaBrowser.Common/Security/IRequiresRegistration.cs+++ b/MediaBrowser.Common/Security/IRequiresRegistration.cs@@ -4,6 +4,12 @@ namespace MediaBrowser.Common.Security{public interface IRequiresRegistration{+ /// <summary>+ /// Load all registration information required for this entity.+ /// Your class should re-load all MBRegistrationRecords when this is called even if they were+ /// previously loaded.+ /// </summary>+ /// <returns></returns>Task LoadRegistrationInfoAsync();}}