mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-21 00:05:26 +03:00
rework EnableMediaPlayback
This commit is contained in:
@@ -12,6 +12,7 @@ using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Library;
|
||||
using MediaBrowser.Model.LiveTv;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -1268,11 +1269,6 @@ namespace MediaBrowser.Api.Playback
|
||||
|
||||
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;
|
||||
|
||||
if (!request.AudioCodec.HasValue)
|
||||
@@ -1288,6 +1284,11 @@ namespace MediaBrowser.Api.Playback
|
||||
|
||||
var item = DtoService.GetItemByDtoId(request.Id);
|
||||
|
||||
if (user != null && item.GetPlayAccess(user) != PlayAccess.Full)
|
||||
{
|
||||
throw new ArgumentException(string.Format("{0} is not allowed to play media.", user.Name));
|
||||
}
|
||||
|
||||
if (item is ILiveTvRecording)
|
||||
{
|
||||
var recording = await LiveTvManager.GetInternalRecording(request.Id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user