mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 02:18:54 -07:00
fixes #566 - Add permission configuration for remote control
This commit is contained in:
parent
ee912d4113
commit
2f99b2e1e6
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
|
|
||||||
public bool DisplayMissingEpisodes { get; set; }
|
public bool DisplayMissingEpisodes { get; set; }
|
||||||
public bool DisplayUnairedEpisodes { get; set; }
|
public bool DisplayUnairedEpisodes { get; set; }
|
||||||
|
public bool EnableRemoteControlOfOtherUsers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
|
||||||
@ -65,6 +66,7 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
public UserConfiguration()
|
public UserConfiguration()
|
||||||
{
|
{
|
||||||
IsAdministrator = true;
|
IsAdministrator = true;
|
||||||
|
EnableRemoteControlOfOtherUsers = true;
|
||||||
BlockNotRated = false;
|
BlockNotRated = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user