display additional users in dashboard
This commit is contained in:
parent
135168b0e0
commit
f93fb4650c
|
@ -239,7 +239,7 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
if (!user.Configuration.EnableRemoteControlOfOtherUsers)
|
if (!user.Configuration.EnableRemoteControlOfOtherUsers)
|
||||||
{
|
{
|
||||||
result = result.Where(i => !i.UserId.HasValue || i.UserId.Value == request.ControllableByUserId.Value);
|
result = result.Where(i => !i.UserId.HasValue || i.ContainsUser(request.ControllableByUserId.Value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using MediaBrowser.Model.Session;
|
using MediaBrowser.Model.Session;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Session
|
namespace MediaBrowser.Controller.Session
|
||||||
{
|
{
|
||||||
|
@ -14,10 +15,10 @@ namespace MediaBrowser.Controller.Session
|
||||||
{
|
{
|
||||||
QueueableMediaTypes = new List<string>();
|
QueueableMediaTypes = new List<string>();
|
||||||
|
|
||||||
AdditionalUsersPresent = new List<SessionUserInfo>();
|
AdditionalUsers = new List<SessionUserInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SessionUserInfo> AdditionalUsersPresent { get; set; }
|
public List<SessionUserInfo> AdditionalUsers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the remote end point.
|
/// Gets or sets the remote end point.
|
||||||
|
@ -172,5 +173,10 @@ namespace MediaBrowser.Controller.Session
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ContainsUser(Guid userId)
|
||||||
|
{
|
||||||
|
return (UserId ?? Guid.Empty) == UserId || AdditionalUsers.Any(i => userId == new Guid(i.UserId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace MediaBrowser.Model.Session
|
||||||
/// Gets or sets the additional users present.
|
/// Gets or sets the additional users present.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The additional users present.</value>
|
/// <value>The additional users present.</value>
|
||||||
public List<SessionUserInfo> AdditionalUsersPresent { get; set; }
|
public List<SessionUserInfo> AdditionalUsers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the application version.
|
/// Gets or sets the application version.
|
||||||
|
@ -137,7 +137,7 @@ namespace MediaBrowser.Model.Session
|
||||||
|
|
||||||
public SessionInfoDto()
|
public SessionInfoDto()
|
||||||
{
|
{
|
||||||
AdditionalUsersPresent = new List<SessionUserInfo>();
|
AdditionalUsers = new List<SessionUserInfo>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||||
CanSeek = session.CanSeek,
|
CanSeek = session.CanSeek,
|
||||||
QueueableMediaTypes = session.QueueableMediaTypes,
|
QueueableMediaTypes = session.QueueableMediaTypes,
|
||||||
RemoteEndPoint = session.RemoteEndPoint,
|
RemoteEndPoint = session.RemoteEndPoint,
|
||||||
AdditionalUsersPresent = session.AdditionalUsersPresent
|
AdditionalUsers = session.AdditionalUsers
|
||||||
};
|
};
|
||||||
|
|
||||||
if (session.NowPlayingItem != null)
|
if (session.NowPlayingItem != null)
|
||||||
|
|
|
@ -236,7 +236,7 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
|
|
||||||
if (!userId.HasValue)
|
if (!userId.HasValue)
|
||||||
{
|
{
|
||||||
connection.AdditionalUsersPresent.Clear();
|
connection.AdditionalUsers.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection.SessionController == null)
|
if (connection.SessionController == null)
|
||||||
|
@ -264,7 +264,7 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
|
|
||||||
users.Add(user);
|
users.Add(user);
|
||||||
|
|
||||||
var additionalUsers = session.AdditionalUsersPresent
|
var additionalUsers = session.AdditionalUsers
|
||||||
.Select(i => _userManager.GetUserById(new Guid(i.UserId)))
|
.Select(i => _userManager.GetUserById(new Guid(i.UserId)))
|
||||||
.Where(i => i != null);
|
.Where(i => i != null);
|
||||||
|
|
||||||
|
@ -753,11 +753,11 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
throw new ArgumentException("The requested user is already the primary user of the session.");
|
throw new ArgumentException("The requested user is already the primary user of the session.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.AdditionalUsersPresent.All(i => new Guid(i.UserId) != userId))
|
if (session.AdditionalUsers.All(i => new Guid(i.UserId) != userId))
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
|
|
||||||
session.AdditionalUsersPresent.Add(new SessionUserInfo
|
session.AdditionalUsers.Add(new SessionUserInfo
|
||||||
{
|
{
|
||||||
UserId = userId.ToString("N"),
|
UserId = userId.ToString("N"),
|
||||||
UserName = user.Name
|
UserName = user.Name
|
||||||
|
@ -786,11 +786,11 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
throw new ArgumentException("The requested user is already the primary user of the session.");
|
throw new ArgumentException("The requested user is already the primary user of the session.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = session.AdditionalUsersPresent.FirstOrDefault(i => new Guid(i.UserId) == userId);
|
var user = session.AdditionalUsers.FirstOrDefault(i => new Guid(i.UserId) == userId);
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
session.AdditionalUsersPresent.Remove(user);
|
session.AdditionalUsers.Remove(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user