diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2021-04-11 13:30:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-11 13:30:15 -0400 |
| commit | 770c123d12806253675624d165ff08fe9ddbd7de (patch) | |
| tree | b39f97b1d033167b337b76d6cc6053088ca2816a /Jellyfin.Api/Controllers/ItemsController.cs | |
| parent | 19e7ebb27927737ab38499be1f66621cf14f6698 (diff) | |
| parent | f2e74917550e8c5d532d180d01eeaa01d92a6cf2 (diff) | |
Merge pull request #5764 from cvium/fix-folders-perms
Do not check permissions for Folders collectiontype
Diffstat (limited to 'Jellyfin.Api/Controllers/ItemsController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/ItemsController.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Jellyfin.Api/Controllers/ItemsController.cs b/Jellyfin.Api/Controllers/ItemsController.cs index 2c9760f6d..74cf3b162 100644 --- a/Jellyfin.Api/Controllers/ItemsController.cs +++ b/Jellyfin.Api/Controllers/ItemsController.cs @@ -246,8 +246,13 @@ namespace Jellyfin.Api.Controllers folder = _libraryManager.GetUserRootFolder(); } - if (folder is IHasCollectionType hasCollectionType - && string.Equals(hasCollectionType.CollectionType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase)) + string? collectionType = null; + if (folder is IHasCollectionType hasCollectionType) + { + collectionType = hasCollectionType.CollectionType; + } + + if (string.Equals(collectionType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase)) { recursive = true; includeItemTypes = new[] { BaseItemKind.Playlist }; @@ -270,10 +275,11 @@ namespace Jellyfin.Api.Controllers } } - if (!(item is UserRootFolder) + if (item is not UserRootFolder && !isInEnabledFolder && !user.HasPermission(PermissionKind.EnableAllFolders) - && !user.HasPermission(PermissionKind.EnableAllChannels)) + && !user.HasPermission(PermissionKind.EnableAllChannels) + && !string.Equals(collectionType, CollectionType.Folders, StringComparison.OrdinalIgnoreCase)) { _logger.LogWarning("{UserName} is not permitted to access Library {ItemName}.", user.Username, item.Name); return Unauthorized($"{user.Username} is not permitted to access Library {item.Name}."); |
