|
|
@ -1,4 +1,5 @@
|
|
|
|
using MediaBrowser.Controller.Dto;
|
|
|
|
using MediaBrowser.Controller.Dto;
|
|
|
|
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
using MediaBrowser.Controller.Session;
|
|
|
|
using MediaBrowser.Controller.Session;
|
|
|
|
using MediaBrowser.Model.Session;
|
|
|
|
using MediaBrowser.Model.Session;
|
|
|
|
using ServiceStack.ServiceHost;
|
|
|
|
using ServiceStack.ServiceHost;
|
|
|
@ -182,16 +183,18 @@ namespace MediaBrowser.Api
|
|
|
|
private readonly ISessionManager _sessionManager;
|
|
|
|
private readonly ISessionManager _sessionManager;
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IDtoService _dtoService;
|
|
|
|
private readonly IDtoService _dtoService;
|
|
|
|
|
|
|
|
private readonly IUserManager _userManager;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="SessionsService" /> class.
|
|
|
|
/// Initializes a new instance of the <see cref="SessionsService" /> class.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sessionManager">The session manager.</param>
|
|
|
|
/// <param name="sessionManager">The session manager.</param>
|
|
|
|
/// <param name="dtoService">The dto service.</param>
|
|
|
|
/// <param name="dtoService">The dto service.</param>
|
|
|
|
public SessionsService(ISessionManager sessionManager, IDtoService dtoService)
|
|
|
|
public SessionsService(ISessionManager sessionManager, IDtoService dtoService, IUserManager userManager)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_sessionManager = sessionManager;
|
|
|
|
_sessionManager = sessionManager;
|
|
|
|
_dtoService = dtoService;
|
|
|
|
_dtoService = dtoService;
|
|
|
|
|
|
|
|
_userManager = userManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -208,6 +211,16 @@ namespace MediaBrowser.Api
|
|
|
|
result = result.Where(i => i.SupportsRemoteControl == request.SupportsRemoteControl.Value);
|
|
|
|
result = result.Where(i => i.SupportsRemoteControl == request.SupportsRemoteControl.Value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (request.ControllableByUserId.HasValue)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var user = _userManager.GetUserById(request.ControllableByUserId.Value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!user.Configuration.EnableRemoteControlOfOtherUsers)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result = result.Where(i => i.User == null || i.User.Id == request.ControllableByUserId.Value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ToOptimizedResult(result.Select(_dtoService.GetSessionInfoDto).ToList());
|
|
|
|
return ToOptimizedResult(result.Select(_dtoService.GetSessionInfoDto).ToList());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|