mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 04:34:18 +01:00
3.0.5340.20849
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Dto
|
||||
@@ -16,6 +17,7 @@ namespace MediaBrowser.Controller.Dto
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>UserDto.</returns>
|
||||
[Obsolete]
|
||||
UserDto GetUserDto(User user);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -934,19 +934,50 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public IEnumerable<BaseItem> GetLinkedChildren(User user)
|
||||
{
|
||||
if (!FilterLinkedChildrenPerUser)
|
||||
if (!FilterLinkedChildrenPerUser || user == null)
|
||||
{
|
||||
return GetLinkedChildren();
|
||||
}
|
||||
|
||||
var locations = user.RootFolder
|
||||
.Children
|
||||
.GetChildren(user, true)
|
||||
.OfType<CollectionFolder>()
|
||||
.SelectMany(i => i.PhysicalLocations)
|
||||
.ToList();
|
||||
|
||||
return LinkedChildren.Where(i => string.IsNullOrWhiteSpace(i.Path) || locations.Any(l => FileSystem.ContainsSubPath(l, i.Path)))
|
||||
.Select(GetLinkedChild)
|
||||
return LinkedChildren
|
||||
.Select(i =>
|
||||
{
|
||||
var requiresPostFilter = true;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(i.Path))
|
||||
{
|
||||
requiresPostFilter = false;
|
||||
|
||||
if (!locations.Any(l => FileSystem.ContainsSubPath(l, i.Path)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var child = GetLinkedChild(i);
|
||||
|
||||
if (requiresPostFilter && child != null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(child.Path))
|
||||
{
|
||||
Logger.Debug("Found LinkedChild with null path: {0}", child.Name);
|
||||
return child;
|
||||
}
|
||||
|
||||
if (!locations.Any(l => FileSystem.ContainsSubPath(l, child.Path)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return child;
|
||||
})
|
||||
.Where(i => i != null);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@@ -8,6 +6,7 @@ using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -81,8 +80,6 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
{
|
||||
var children = base.GetChildren(user, includeLinkedChildren);
|
||||
|
||||
children = Playlist.FilterInaccessibleItems(children, user);
|
||||
|
||||
if (string.Equals(DisplayOrder, ItemSortBy.SortName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Sort by name
|
||||
@@ -99,12 +96,6 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
|
||||
}
|
||||
|
||||
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, bool includeLinkedChildren = true)
|
||||
{
|
||||
var children = base.GetRecursiveChildren(user, includeLinkedChildren);
|
||||
return Playlist.FilterInaccessibleItems(children, user);
|
||||
}
|
||||
|
||||
public BoxSetInfo GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<BoxSetInfo>();
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
/// <value>The password.</value>
|
||||
public string Password { get; set; }
|
||||
public string LocalPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -53,10 +54,11 @@ namespace MediaBrowser.Controller.Library
|
||||
/// </summary>
|
||||
/// <param name="username">The username.</param>
|
||||
/// <param name="password">The password.</param>
|
||||
/// <param name="remoteEndPoint">The remote end point.</param>
|
||||
/// <returns>Task{System.Boolean}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
Task<bool> AuthenticateUser(string username, string password);
|
||||
|
||||
Task<bool> AuthenticateUser(string username, string password, string remoteEndPoint);
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes metadata for each user
|
||||
/// </summary>
|
||||
@@ -114,5 +116,13 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="newPassword">The new password.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task ChangePassword(User user, string newPassword);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user dto.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="remoteEndPoint">The remote end point.</param>
|
||||
/// <returns>UserDto.</returns>
|
||||
UserDto GetUserDto(User user, string remoteEndPoint = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,30 +72,7 @@ namespace MediaBrowser.Controller.Playlists
|
||||
|
||||
}).Where(m => string.Equals(m.MediaType, playlistMediaType, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return FilterInaccessibleItems(inputItems, user);
|
||||
}
|
||||
|
||||
public static IEnumerable<BaseItem> FilterInaccessibleItems(IEnumerable<BaseItem> items, User user)
|
||||
{
|
||||
return items;
|
||||
//var locations = user.RootFolder.Children.OfType<CollectionFolder>().SelectMany(i => i.PhysicalLocations).ToList();
|
||||
|
||||
//return items.Where(i =>
|
||||
//{
|
||||
// var parent = i.Parent;
|
||||
|
||||
// while (parent != null)
|
||||
// {
|
||||
// parent = parent.Parent;
|
||||
|
||||
// if (parent != null && parent.Parent is AggregateFolder)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return parent == null || locations.Contains(parent.Path, StringComparer.OrdinalIgnoreCase);
|
||||
//});
|
||||
return inputItems;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
||||
Reference in New Issue
Block a user