rework EnableMediaPlayback

This commit is contained in:
Luke Pulverenti
2014-02-21 00:35:56 -05:00
parent 7cd41a6ed6
commit 2ceea17bf4
10 changed files with 59 additions and 23 deletions

View File

@@ -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);