mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-21 13:10:45 +02:00
fixes #683 - Support disabling playback per user
This commit is contained in:
parent
bd0a1b70d0
commit
4ce43ce019
|
@ -1007,6 +1007,13 @@ namespace MediaBrowser.Api.Playback
|
||||||
throw new InvalidOperationException("You asked for a debug error, you got one.");
|
throw new InvalidOperationException("You asked for a debug error, you got one.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var user = AuthorizationRequestFilterAttribute.GetCurrentUser(Request, UserManager);
|
||||||
|
|
||||||
|
if (user != null && !user.Configuration.EnableMediaPlayback)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(string.Format("{0} is not allowed to play media.", user.Name));
|
||||||
|
}
|
||||||
|
|
||||||
var url = Request.PathInfo;
|
var url = Request.PathInfo;
|
||||||
|
|
||||||
if (!request.AudioCodec.HasValue)
|
if (!request.AudioCodec.HasValue)
|
||||||
|
|
|
@ -69,6 +69,8 @@ namespace MediaBrowser.Model.Configuration
|
||||||
|
|
||||||
public bool EnableLiveTvManagement { get; set; }
|
public bool EnableLiveTvManagement { get; set; }
|
||||||
|
|
||||||
|
public bool EnableMediaPlayback { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -79,6 +81,7 @@ namespace MediaBrowser.Model.Configuration
|
||||||
BlockNotRated = false;
|
BlockNotRated = false;
|
||||||
|
|
||||||
EnableLiveTvManagement = true;
|
EnableLiveTvManagement = true;
|
||||||
|
EnableMediaPlayback = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,6 +604,16 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
var session = GetSessionForRemoteControl(sessionId);
|
var session = GetSessionForRemoteControl(sessionId);
|
||||||
|
|
||||||
|
if (session.UserId.HasValue)
|
||||||
|
{
|
||||||
|
var user = _userManager.GetUserById(session.UserId.Value);
|
||||||
|
|
||||||
|
if (!user.Configuration.EnableMediaPlayback)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(string.Format("{0} is not allowed to play media.", user.Name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var items = command.ItemIds.Select(i => _libraryManager.GetItemById(new Guid(i)))
|
var items = command.ItemIds.Select(i => _libraryManager.GetItemById(new Guid(i)))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue