fixed sync menu not displaying options

This commit is contained in:
Luke Pulverenti 2015-02-16 22:49:47 -05:00
parent 72f00ebf2d
commit 053f2fccbf

View File

@ -145,12 +145,14 @@ namespace MediaBrowser.Api.Sync
private readonly ISyncManager _syncManager;
private readonly IDtoService _dtoService;
private readonly ILibraryManager _libraryManager;
private readonly IUserManager _userManager;
public SyncService(ISyncManager syncManager, IDtoService dtoService, ILibraryManager libraryManager)
public SyncService(ISyncManager syncManager, IDtoService dtoService, ILibraryManager libraryManager, IUserManager userManager)
{
_syncManager = syncManager;
_dtoService = dtoService;
_libraryManager = libraryManager;
_userManager = userManager;
}
public object Get(GetSyncTargets request)
@ -238,11 +240,15 @@ namespace MediaBrowser.Api.Sync
}
};
var auth = AuthorizationContext.GetAuthorizationInfo(Request);
var authenticatedUser = _userManager.GetUserById(auth.UserId);
var items = request.ItemIds.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(_libraryManager.GetItemById)
.Where(i => i != null);
var dtos = _dtoService.GetBaseItemDtos(items, dtoOptions)
var dtos = _dtoService.GetBaseItemDtos(items, dtoOptions, authenticatedUser)
.ToList();
result.Options = SyncHelper.GetSyncOptions(dtos);