Explorar o código

fix issue #1347 introduced in pr #930

Jörn %!s(int64=6) %!d(string=hai) anos
pai
achega
1fd8164756
Modificáronse 2 ficheiros con 12 adicións e 1 borrados
  1. 1 0
      CONTRIBUTORS.md
  2. 11 1
      MediaBrowser.Api/UserLibrary/ItemsService.cs

+ 1 - 0
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
 

+ 11 - 1
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<BaseItem>