Prechádzať zdrojové kódy

Extract ISecurityManager interface

Eric Reed 12 rokov pred
rodič
commit
1925288a86

+ 1 - 0
MediaBrowser.Common/MediaBrowser.Common.csproj

@@ -136,6 +136,7 @@
     <Compile Include="ScheduledTasks\DailyTrigger.cs" />
     <Compile Include="ScheduledTasks\IntervalTrigger.cs" />
     <Compile Include="ScheduledTasks\WeeklyTrigger.cs" />
+    <Compile Include="Security\ISecurityManager.cs" />
     <Compile Include="Updates\IInstallationManager.cs" />
   </ItemGroup>
   <ItemGroup>

+ 34 - 0
MediaBrowser.Common/Security/ISecurityManager.cs

@@ -0,0 +1,34 @@
+using System.Threading.Tasks;
+using Mediabrowser.Model.Entities;
+
+namespace MediaBrowser.Common.Security
+{
+    public interface ISecurityManager
+    {
+        /// <summary>
+        /// Gets a value indicating whether this instance is MB supporter.
+        /// </summary>
+        /// <value><c>true</c> if this instance is MB supporter; otherwise, <c>false</c>.</value>
+        bool IsMBSupporter { get; }
+
+        /// <summary>
+        /// Gets or sets the supporter key.
+        /// </summary>
+        /// <value>The supporter key.</value>
+        string SupporterKey { get; set; }
+
+        /// <summary>
+        /// Gets or sets the legacy key.
+        /// </summary>
+        /// <value>The legacy key.</value>
+        string LegacyKey { get; set; }
+
+        /// <summary>
+        /// Gets the registration status.
+        /// </summary>
+        /// <param name="feature">The feature.</param>
+        /// <param name="mb2Equivalent">The MB2 equivalent.</param>
+        /// <returns>Task{MBRegistrationRecord}.</returns>
+        Task<MBRegistrationRecord> GetRegistrationStatus(string feature, string mb2Equivalent = null);
+    }
+}

+ 3 - 2
MediaBrowser.Controller/Plugins/PluginSecurityManager.cs

@@ -1,4 +1,5 @@
-using MediaBrowser.Model.Serialization;
+using MediaBrowser.Common.Security;
+using MediaBrowser.Model.Serialization;
 using Mediabrowser.Model.Entities;
 using Mediabrowser.PluginSecurity;
 using MediaBrowser.Common.Kernel;
@@ -12,7 +13,7 @@ namespace MediaBrowser.Controller.Plugins
     /// <summary>
     /// Class PluginSecurityManager
     /// </summary>
-    public class PluginSecurityManager
+    public class PluginSecurityManager : ISecurityManager
     {
         /// <summary>
         /// The _is MB supporter