diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-15 12:35:41 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-15 12:35:41 -0400 |
| commit | e3c86944718d68806ad42c4d14c964a72da90b44 (patch) | |
| tree | 521f7cf81f29ac302ce5545cdc5ecde66f977182 /MediaBrowser.Controller | |
| parent | 9c5cceb4ecc277ffb5a3a988f655ad674bf41c58 (diff) | |
3.0.5340.20849
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Dto/IDtoService.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 39 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Movies/BoxSet.cs | 13 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/User.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/IUserManager.cs | 14 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Playlists/Playlist.cs | 25 |
6 files changed, 53 insertions, 41 deletions
diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.cs index 434e896dad..fc15eedf04 100644 --- a/MediaBrowser.Controller/Dto/IDtoService.cs +++ b/MediaBrowser.Controller/Dto/IDtoService.cs @@ -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> diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 96a8c579e2..79c96dd5e4 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -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); } diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index 5d8fff38f4..705cf90575 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -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>(); diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index b9c419722d..e4fd929ffd 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -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. diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs index c6bbf02ae7..a5d949c8a2 100644 --- a/MediaBrowser.Controller/Library/IUserManager.cs +++ b/MediaBrowser.Controller/Library/IUserManager.cs @@ -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); } } diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs index 7822623a97..05a894223e 100644 --- a/MediaBrowser.Controller/Playlists/Playlist.cs +++ b/MediaBrowser.Controller/Playlists/Playlist.cs @@ -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] |
