placeholder for plugin security fix

This commit is contained in:
LukePulverenti 2013-02-23 17:44:42 -05:00
parent 637319e1ce
commit 6c86721f6d
2 changed files with 38 additions and 7 deletions

View File

@ -151,5 +151,10 @@ namespace MediaBrowser.Common.Kernel
/// </summary> /// </summary>
/// <value>The rest services.</value> /// <value>The rest services.</value>
IEnumerable<IRestfulService> RestServices { get; } IEnumerable<IRestfulService> RestServices { get; }
/// <summary>
/// Notifies the pending restart.
/// </summary>
void NotifyPendingRestart();
} }
} }

View File

@ -1,5 +1,8 @@
using Mediabrowser.Model.Entities; using Mediabrowser.Model.Entities;
using Mediabrowser.PluginSecurity; using Mediabrowser.PluginSecurity;
using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Net;
using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,7 +11,7 @@ namespace MediaBrowser.Controller.Plugins
/// <summary> /// <summary>
/// Class PluginSecurityManager /// Class PluginSecurityManager
/// </summary> /// </summary>
public class PluginSecurityManager : BaseManager<Kernel> public class PluginSecurityManager
{ {
/// <summary> /// <summary>
/// The _is MB supporter /// The _is MB supporter
@ -36,12 +39,32 @@ namespace MediaBrowser.Controller.Plugins
} }
} }
/// <summary>
/// The _network manager
/// </summary>
private INetworkManager _networkManager;
private IKernel _kernel;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PluginSecurityManager" /> class. /// Initializes a new instance of the <see cref="PluginSecurityManager" /> class.
/// </summary> /// </summary>
/// <param name="kernel">The kernel.</param> /// <param name="kernel">The kernel.</param>
public PluginSecurityManager(Kernel kernel) : base(kernel) /// <param name="networkManager">The network manager.</param>
public PluginSecurityManager(IKernel kernel, INetworkManager networkManager)
{ {
if (kernel == null)
{
throw new ArgumentNullException("kernel");
}
if (networkManager == null)
{
throw new ArgumentNullException("networkManager");
}
_kernel = kernel;
_networkManager = networkManager;
} }
/// <summary> /// <summary>
@ -52,6 +75,7 @@ namespace MediaBrowser.Controller.Plugins
/// <returns>Task{MBRegistrationRecord}.</returns> /// <returns>Task{MBRegistrationRecord}.</returns>
public async Task<MBRegistrationRecord> GetRegistrationStatus(string feature, string mb2Equivalent = null) public async Task<MBRegistrationRecord> GetRegistrationStatus(string feature, string mb2Equivalent = null)
{ {
// Update this method to add _networkManager as a param.
return await MBRegistration.GetRegistrationStatus(feature, mb2Equivalent).ConfigureAwait(false); return await MBRegistration.GetRegistrationStatus(feature, mb2Equivalent).ConfigureAwait(false);
} }
@ -62,14 +86,15 @@ namespace MediaBrowser.Controller.Plugins
public string SupporterKey public string SupporterKey
{ {
get { return MBRegistration.SupporterKey; } get { return MBRegistration.SupporterKey; }
set { set
{
if (value != MBRegistration.SupporterKey) if (value != MBRegistration.SupporterKey)
{ {
MBRegistration.SupporterKey = value; MBRegistration.SupporterKey = value;
// Clear this so it will re-evaluate // Clear this so it will re-evaluate
ResetSupporterInfo(); ResetSupporterInfo();
// And we'll need to restart to re-evaluate the status of plug-ins // And we'll need to restart to re-evaluate the status of plug-ins
Kernel.NotifyPendingRestart(); _kernel.NotifyPendingRestart();
} }
} }
@ -82,10 +107,11 @@ namespace MediaBrowser.Controller.Plugins
public string LegacyKey public string LegacyKey
{ {
get { return MBRegistration.LegacyKey; } get { return MBRegistration.LegacyKey; }
set { set
{
MBRegistration.LegacyKey = value; MBRegistration.LegacyKey = value;
// And we'll need to restart to re-evaluate the status of plug-ins // And we'll need to restart to re-evaluate the status of plug-ins
Kernel.NotifyPendingRestart(); _kernel.NotifyPendingRestart();
} }
} }