From 1fd81647560c12728e2eb64430360d0570336f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn?= Date: Mon, 24 Jun 2019 15:06:49 -0700 Subject: [PATCH] fix issue #1347 introduced in pr #930 --- CONTRIBUTORS.md | 1 + MediaBrowser.Api/UserLibrary/ItemsService.cs | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 29456598f1..9168dccc8c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -26,6 +26,7 @@ - [ploughpuff](https://github.com/ploughpuff) - [pjeanjean](https://github.com/pjeanjean) - [DrPandemic](https://github.com/drpandemic) + - [joern-h](https://github.com/joern-h) # Emby Contributors diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index f1ae484922..f842230ee3 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -224,7 +224,17 @@ namespace MediaBrowser.Api.UserLibrary request.IncludeItemTypes = "Playlist"; } - if (!(item is UserRootFolder) && !user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Any(i => new Guid(i) == item.Id)) + bool isInEnabledFolder = user.Policy.EnabledFolders.Any(i => new Guid(i) == item.Id); + var collectionFolders = _libraryManager.GetCollectionFolders(item); + foreach (var collectionFolder in collectionFolders) + { + if (user.Policy.EnabledFolders.Contains(collectionFolder.Id.ToString("N"), StringComparer.OrdinalIgnoreCase)) + { + isInEnabledFolder = true; + } + } + + if (!(item is UserRootFolder) && !user.Policy.EnableAllFolders && !isInEnabledFolder) { Logger.LogWarning("{UserName} is not permitted to access Library {ItemName}.", user.Name, item.Name); return new QueryResult