Fix media folders endpoint access control

pull/8753/head
Bill Thornton 2 years ago
parent 6c8b40f413
commit 4f3d562d75

@ -11,6 +11,7 @@ using System.Threading.Tasks;
using Jellyfin.Api.Attributes;
using Jellyfin.Api.Constants;
using Jellyfin.Api.Extensions;
using Jellyfin.Api.Helpers;
using Jellyfin.Api.ModelBinders;
using Jellyfin.Api.Models.LibraryDtos;
using Jellyfin.Data.Entities;
@ -498,6 +499,12 @@ namespace Jellyfin.Api.Controllers
{
var items = _libraryManager.GetUserRootFolder().Children.Concat(_libraryManager.RootFolder.VirtualChildren).OrderBy(i => i.SortName).ToList();
if (!ClaimHelpers.GetIsApiKey(User) && !User.IsInRole(UserRoles.Administrator))
{
var user = _userManager.GetUserById(ClaimHelpers.GetUserId(User)!.Value);
items = items.Where(i => i.IsVisible(user)).ToList();
}
if (isHidden.HasValue)
{
var val = isHidden.Value;

Loading…
Cancel
Save