mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-17 22:43:07 +03:00
Merge pull request #930 from fruhnow/AuthorizationCheck
checking user-permission in GetQueryResult
This commit is contained in:
@@ -12,6 +12,7 @@ using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Api.UserLibrary
|
||||
{
|
||||
@@ -224,6 +225,16 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
request.IncludeItemTypes = "Playlist";
|
||||
}
|
||||
|
||||
if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Any(i => new Guid(i) == item.Id))
|
||||
{
|
||||
Logger.LogWarning("{UserName} is not permitted to access Library {ItemName}.", user.Name, item.Name);
|
||||
return new QueryResult<BaseItem>
|
||||
{
|
||||
Items = Array.Empty<BaseItem>(),
|
||||
TotalRecordCount = 0
|
||||
};
|
||||
}
|
||||
|
||||
if (request.Recursive || !string.IsNullOrEmpty(request.Ids) || user == null)
|
||||
{
|
||||
return folder.GetItems(GetItemsQuery(request, dtoOptions, user));
|
||||
|
||||
Reference in New Issue
Block a user