fixes for new user settings

pull/702/head
Luke Pulverenti 11 years ago
parent 1a0a50c8ab
commit b70ecab40a

@ -197,7 +197,8 @@ namespace MediaBrowser.Api
{
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 (_userManager.Users.Count(i => !i.Configuration.IsDisabled) == 1)

@ -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 (!dto.HasLogo)
{
var parentWithLogo = GetParentLogoItem(item);
var parentWithLogo = GetParentImageItem(item, ImageType.Logo);
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))
{
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
/// </summary>
/// <param name="item">The item.</param>
/// <param name="type">The type.</param>
/// <returns>BaseItem.</returns>
private BaseItem GetParentLogoItem(BaseItem item)
private BaseItem GetParentImageItem(BaseItem item, ImageType type)
{
var parent = item.Parent;
while (parent != null)
{
if (parent.HasImage(ImageType.Logo))
if (parent.HasImage(type))
{
return parent;
}

@ -640,6 +640,14 @@ namespace MediaBrowser.Model.ApiClient
/// <exception cref="ArgumentNullException">item</exception>
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>
/// Gets the url needed to stream an audio file
/// </summary>

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

@ -416,6 +416,18 @@ namespace MediaBrowser.Model.Dto
/// <value>The parent logo image tag.</value>
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>
/// Gets or sets the chapters.
/// </summary>

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

Loading…
Cancel
Save