浏览代码

fixes for new user settings

Luke Pulverenti 12 年之前
父节点
当前提交
b70ecab40a

+ 9 - 2
MediaBrowser.Api/UserService.cs

@@ -197,7 +197,8 @@ namespace MediaBrowser.Api
         {
         {
             return Get(new GetUsers
             return Get(new GetUsers
             {
             {
-                IsHidden = false
+                IsHidden = false,
+                IsDisabled = false
             });
             });
         }
         }
 
 
@@ -367,7 +368,13 @@ namespace MediaBrowser.Api
                 }
                 }
             }
             }
 
 
-            // If removing admin access
+            // If disabling
+            if (dtoUser.Configuration.IsDisabled && user.Configuration.IsAdministrator)
+            {
+                throw new ArgumentException("Administrators cannot be disabled.");
+            }
+
+            // If disabling
             if (dtoUser.Configuration.IsDisabled && !user.Configuration.IsDisabled)
             if (dtoUser.Configuration.IsDisabled && !user.Configuration.IsDisabled)
             {
             {
                 if (_userManager.Users.Count(i => !i.Configuration.IsDisabled) == 1)
                 if (_userManager.Users.Count(i => !i.Configuration.IsDisabled) == 1)

+ 17 - 3
MediaBrowser.Controller/Dto/DtoBuilder.cs

@@ -364,7 +364,7 @@ namespace MediaBrowser.Controller.Dto
             // If there is no logo, indicate what parent has one in case the Ui wants to allow inheritance
             // If there is no logo, indicate what parent has one in case the Ui wants to allow inheritance
             if (!dto.HasLogo)
             if (!dto.HasLogo)
             {
             {
-                var parentWithLogo = GetParentLogoItem(item);
+                var parentWithLogo = GetParentImageItem(item, ImageType.Logo);
 
 
                 if (parentWithLogo != null)
                 if (parentWithLogo != null)
                 {
                 {
@@ -374,6 +374,19 @@ namespace MediaBrowser.Controller.Dto
                 }
                 }
             }
             }
 
 
+            // If there is no art, indicate what parent has one in case the Ui wants to allow inheritance
+            if (!dto.HasArtImage)
+            {
+                var parentWithImage = GetParentImageItem(item, ImageType.Art);
+
+                if (parentWithImage != null)
+                {
+                    dto.ParentLogoItemId = GetClientItemId(parentWithImage);
+
+                    dto.ParentLogoImageTag = GetImageCacheTag(parentWithImage, ImageType.Art, parentWithImage.GetImage(ImageType.Art));
+                }
+            }
+
             if (fields.Contains(ItemFields.Path))
             if (fields.Contains(ItemFields.Path))
             {
             {
                 dto.Path = item.Path;
                 dto.Path = item.Path;
@@ -751,14 +764,15 @@ namespace MediaBrowser.Controller.Dto
         /// If an item does not have a logo, this can be used to find the first parent that does have one
         /// If an item does not have a logo, this can be used to find the first parent that does have one
         /// </summary>
         /// </summary>
         /// <param name="item">The item.</param>
         /// <param name="item">The item.</param>
+        /// <param name="type">The type.</param>
         /// <returns>BaseItem.</returns>
         /// <returns>BaseItem.</returns>
-        private BaseItem GetParentLogoItem(BaseItem item)
+        private BaseItem GetParentImageItem(BaseItem item, ImageType type)
         {
         {
             var parent = item.Parent;
             var parent = item.Parent;
 
 
             while (parent != null)
             while (parent != null)
             {
             {
-                if (parent.HasImage(ImageType.Logo))
+                if (parent.HasImage(type))
                 {
                 {
                     return parent;
                     return parent;
                 }
                 }

+ 8 - 0
MediaBrowser.Model/ApiClient/IApiClient.cs

@@ -640,6 +640,14 @@ namespace MediaBrowser.Model.ApiClient
         /// <exception cref="ArgumentNullException">item</exception>
         /// <exception cref="ArgumentNullException">item</exception>
         string GetLogoImageUrl(BaseItemDto item, ImageOptions options);
         string GetLogoImageUrl(BaseItemDto item, ImageOptions options);
 
 
+        /// <summary>
+        /// Gets the art image URL.
+        /// </summary>
+        /// <param name="item">The item.</param>
+        /// <param name="options">The options.</param>
+        /// <returns>System.String.</returns>
+        string GetArtImageUrl(BaseItemDto item, ImageOptions options);
+        
         /// <summary>
         /// <summary>
         /// Gets the url needed to stream an audio file
         /// Gets the url needed to stream an audio file
         /// </summary>
         /// </summary>

+ 1 - 2
MediaBrowser.Model/Configuration/ManualLoginCategory.cs

@@ -4,7 +4,6 @@ namespace MediaBrowser.Model.Configuration
     public enum ManualLoginCategory
     public enum ManualLoginCategory
     {
     {
         Mobile,
         Mobile,
-        MediaBrowserTheater,
-        Roku
+        MediaBrowserTheater
     }
     }
 }
 }

+ 12 - 0
MediaBrowser.Model/Dto/BaseItemDto.cs

@@ -416,6 +416,18 @@ namespace MediaBrowser.Model.Dto
         /// <value>The parent logo image tag.</value>
         /// <value>The parent logo image tag.</value>
         public Guid? ParentLogoImageTag { get; set; }
         public Guid? ParentLogoImageTag { get; set; }
 
 
+        /// <summary>
+        /// If the item does not have a art, this will hold the Id of the Parent that has one.
+        /// </summary>
+        /// <value>The parent art item id.</value>
+        public string ParentArtItemId { get; set; }
+
+        /// <summary>
+        /// Gets or sets the parent art image tag.
+        /// </summary>
+        /// <value>The parent art image tag.</value>
+        public Guid? ParentArtImageTag { get; set; }
+        
         /// <summary>
         /// <summary>
         /// Gets or sets the chapters.
         /// Gets or sets the chapters.
         /// </summary>
         /// </summary>

+ 2 - 2
MediaBrowser.ServerApplication/ApplicationHost.cs

@@ -1,5 +1,4 @@
-using System.Threading;
-using MediaBrowser.Api;
+using MediaBrowser.Api;
 using MediaBrowser.Common;
 using MediaBrowser.Common;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Constants;
 using MediaBrowser.Common.Constants;
@@ -53,6 +52,7 @@ using System.Diagnostics;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Reflection;
 using System.Reflection;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 
 
 namespace MediaBrowser.ServerApplication
 namespace MediaBrowser.ServerApplication