diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs index 8d9024676..7582f4c91 100644 --- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities.Audio; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Model.Channels; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; @@ -100,5 +101,10 @@ namespace MediaBrowser.Controller.Channels { return false; } + + public override bool IsVisibleStandalone(User user) + { + return base.IsVisibleStandalone(user) && ChannelVideoItem.IsChannelVisible(this, user); + } } } diff --git a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs index 7ba73d126..43f5160a4 100644 --- a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs @@ -80,5 +80,10 @@ namespace MediaBrowser.Controller.Channels { return false; } + + public override bool IsVisibleStandalone(User user) + { + return base.IsVisibleStandalone(user) && ChannelVideoItem.IsChannelVisible(this, user); + } } } diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs index 8eec2021b..d97341d8f 100644 --- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs @@ -130,5 +130,17 @@ namespace MediaBrowser.Controller.Channels { return false; } + + public override bool IsVisibleStandalone(User user) + { + return base.IsVisibleStandalone(user) && IsChannelVisible(this, user); + } + + internal static bool IsChannelVisible(IChannelItem item, User user) + { + var channel = ChannelManager.GetChannel(item.ChannelId); + + return channel.IsVisible(user); + } } } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 94fc76125..27bd09ec7 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1154,9 +1154,19 @@ namespace MediaBrowser.Controller.Entities return false; } - // TODO: Need some work here, e.g. is in user library, for channels, can user access channel, etc. + var topParent = Parents.LastOrDefault() ?? this; - return true; + if (string.IsNullOrWhiteSpace(topParent.Path)) + { + return true; + } + + var locations = user.RootFolder + .GetChildren(user, true) + .OfType() + .SelectMany(i => i.PhysicalLocations); + + return locations.Any(l => FileSystem.ContainsSubPath(l, topParent.Path)); } /// diff --git a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj index c3038cadb..ad561c484 100644 --- a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj +++ b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj @@ -106,7 +106,9 @@ - + + +