diff --git a/MediaBrowser.Api/SessionsService.cs b/MediaBrowser.Api/SessionsService.cs
index 5888d9fba3..a3f7e3037c 100644
--- a/MediaBrowser.Api/SessionsService.cs
+++ b/MediaBrowser.Api/SessionsService.cs
@@ -1,4 +1,5 @@
using MediaBrowser.Controller.Dto;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Session;
using ServiceStack.ServiceHost;
@@ -182,16 +183,18 @@ namespace MediaBrowser.Api
private readonly ISessionManager _sessionManager;
private readonly IDtoService _dtoService;
+ private readonly IUserManager _userManager;
///
/// Initializes a new instance of the class.
///
/// The session manager.
/// The dto service.
- public SessionsService(ISessionManager sessionManager, IDtoService dtoService)
+ public SessionsService(ISessionManager sessionManager, IDtoService dtoService, IUserManager userManager)
{
_sessionManager = sessionManager;
_dtoService = dtoService;
+ _userManager = userManager;
}
///
@@ -208,6 +211,16 @@ namespace MediaBrowser.Api
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());
}
diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs
index 43561cd749..b736474e0d 100644
--- a/MediaBrowser.Model/Configuration/UserConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs
@@ -58,6 +58,7 @@ namespace MediaBrowser.Model.Configuration
public bool DisplayMissingEpisodes { get; set; }
public bool DisplayUnairedEpisodes { get; set; }
+ public bool EnableRemoteControlOfOtherUsers { get; set; }
///
/// Initializes a new instance of the class.
@@ -65,6 +66,7 @@ namespace MediaBrowser.Model.Configuration
public UserConfiguration()
{
IsAdministrator = true;
+ EnableRemoteControlOfOtherUsers = true;
BlockNotRated = false;
}
}