prevent direct repo access
This commit is contained in:
parent
84a702e6e3
commit
fca5a40601
|
@ -500,7 +500,7 @@ namespace MediaBrowser.Api
|
|||
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
|
||||
.ToList();
|
||||
|
||||
var dtos = item.ThemeSongIds.Select(_itemRepo.RetrieveItem)
|
||||
var dtos = item.ThemeSongIds.Select(_libraryManager.GetItemById)
|
||||
.OrderBy(i => i.SortName)
|
||||
.Select(i => _dtoService.GetBaseItemDto(i, fields, user, item));
|
||||
|
||||
|
@ -547,7 +547,7 @@ namespace MediaBrowser.Api
|
|||
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
|
||||
.ToList();
|
||||
|
||||
var dtos = item.ThemeVideoIds.Select(_itemRepo.RetrieveItem)
|
||||
var dtos = item.ThemeVideoIds.Select(_libraryManager.GetItemById)
|
||||
.OrderBy(i => i.SortName)
|
||||
.Select(i => _dtoService.GetBaseItemDto(i, fields, user, item));
|
||||
|
||||
|
|
|
@ -387,8 +387,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
private readonly IItemRepository _itemRepo;
|
||||
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly IDtoService _dtoService;
|
||||
|
||||
|
@ -398,16 +396,14 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <param name="userManager">The user manager.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="userDataRepository">The user data repository.</param>
|
||||
/// <param name="itemRepo">The item repo.</param>
|
||||
/// <param name="sessionManager">The session manager.</param>
|
||||
/// <param name="dtoService">The dto service.</param>
|
||||
/// <exception cref="System.ArgumentNullException">jsonSerializer</exception>
|
||||
public UserLibraryService(IUserManager userManager, ILibraryManager libraryManager, IUserDataRepository userDataRepository, IItemRepository itemRepo, ISessionManager sessionManager, IDtoService dtoService)
|
||||
public UserLibraryService(IUserManager userManager, ILibraryManager libraryManager, IUserDataRepository userDataRepository, ISessionManager sessionManager, IDtoService dtoService)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_libraryManager = libraryManager;
|
||||
_userDataRepository = userDataRepository;
|
||||
_itemRepo = itemRepo;
|
||||
_sessionManager = sessionManager;
|
||||
_dtoService = dtoService;
|
||||
}
|
||||
|
@ -442,7 +438,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
var movie1 = movie;
|
||||
|
||||
var dtos = movie.SpecialFeatureIds
|
||||
.Select(_itemRepo.RetrieveItem)
|
||||
.Select(_libraryManager.GetItemById)
|
||||
.OrderBy(i => i.SortName)
|
||||
.Select(i => _dtoService.GetBaseItemDto(i, fields, user, movie1));
|
||||
|
||||
|
@ -502,7 +498,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
var fields = Enum.GetNames(typeof(ItemFields)).Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)).ToList();
|
||||
|
||||
var dtos = item.LocalTrailerIds
|
||||
.Select(_itemRepo.RetrieveItem)
|
||||
.Select(_libraryManager.GetItemById)
|
||||
.OrderBy(i => i.SortName)
|
||||
.Select(i => _dtoService.GetBaseItemDto(i, fields, user, item));
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
|
@ -26,15 +25,12 @@ namespace MediaBrowser.Api
|
|||
|
||||
public class VideosService : BaseApiService
|
||||
{
|
||||
private readonly IItemRepository _itemRepo;
|
||||
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDtoService _dtoService;
|
||||
|
||||
public VideosService(IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager, IDtoService dtoService)
|
||||
public VideosService( ILibraryManager libraryManager, IUserManager userManager, IDtoService dtoService)
|
||||
{
|
||||
_itemRepo = itemRepo;
|
||||
_libraryManager = libraryManager;
|
||||
_userManager = userManager;
|
||||
_dtoService = dtoService;
|
||||
|
@ -62,7 +58,7 @@ namespace MediaBrowser.Api
|
|||
|
||||
var video = (Video)item;
|
||||
|
||||
var items = video.AdditionalPartIds.Select(_itemRepo.RetrieveItem)
|
||||
var items = video.AdditionalPartIds.Select(_libraryManager.GetItemById)
|
||||
.OrderBy(i => i.SortName)
|
||||
.Select(i => _dtoService.GetBaseItemDto(i, fields, user, video))
|
||||
.ToArray();
|
||||
|
|
Loading…
Reference in New Issue
Block a user