diff options
| author | Felix Ruhnow <fruhnow@outlook.com> | 2019-02-18 18:29:58 +0100 |
|---|---|---|
| committer | Felix Ruhnow <fruhnow@outlook.com> | 2019-02-18 18:29:58 +0100 |
| commit | 967d5deeb79405ce7122c6124dac019b278ca70b (patch) | |
| tree | b97c73b5a821c03965f06621f0545f65ca4b6210 /MediaBrowser.Api | |
| parent | 395072239d329d1deb1af6c57a7961cfada5fc24 (diff) | |
checking user-permission in GetQueryResult to prevent accessing the library without permission but having a link. (+added myself as contributor. forgot last time bout that)
Diffstat (limited to 'MediaBrowser.Api')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/ItemsService.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 3ae7da007..895c88dc8 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -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 { @@ -227,6 +228,16 @@ namespace MediaBrowser.Api.UserLibrary request.IncludeItemTypes = "Playlist"; } + if (!user.Policy.EnabledFolders.Where(i => new Guid(i).Equals(item.Id)).Any() && !user.Policy.EnableAllFolders) + { + Logger.LogWarning($"{user.Name} is not permitted to access Library {item.Name}."); + return new QueryResult<BaseItem> + { + Items = new BaseItem[0], + TotalRecordCount = 0 + }; + } + if (request.Recursive || !string.IsNullOrEmpty(request.Ids) || user == null) { return folder.GetItems(GetItemsQuery(request, dtoOptions, user)); |
