From 5ca4d60c34c7ead76c388bd2c3ca192b38aae1f0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 28 Oct 2014 19:17:55 -0400 Subject: connect updates --- MediaBrowser.Controller/Entities/AdultVideo.cs | 13 +-------- MediaBrowser.Controller/Entities/Movies/Movie.cs | 10 +------ MediaBrowser.Controller/Entities/Trailer.cs | 9 +----- MediaBrowser.Controller/Entities/Video.cs | 8 +++++ MediaBrowser.Controller/LiveTv/LiveTvChannel.cs | 5 ++++ .../Net/AuthenticatedAttribute.cs | 34 ++++++++++++++++++---- MediaBrowser.Controller/Net/IAuthService.cs | 4 +-- MediaBrowser.Controller/Playlists/Playlist.cs | 5 ++++ 8 files changed, 50 insertions(+), 38 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Entities/AdultVideo.cs b/MediaBrowser.Controller/Entities/AdultVideo.cs index 90e54c887c..ec2913ab46 100644 --- a/MediaBrowser.Controller/Entities/AdultVideo.cs +++ b/MediaBrowser.Controller/Entities/AdultVideo.cs @@ -5,19 +5,8 @@ using System.Collections.Generic; namespace MediaBrowser.Controller.Entities { [Obsolete] - public class AdultVideo : Video, IHasProductionLocations, IHasPreferredMetadataLanguage, IHasTaglines + public class AdultVideo : Video, IHasProductionLocations, IHasTaglines { - /// - /// Gets or sets the preferred metadata language. - /// - /// The preferred metadata language. - public string PreferredMetadataLanguage { get; set; } - - /// - /// Gets or sets the preferred metadata country code. - /// - /// The preferred metadata country code. - public string PreferredMetadataCountryCode { get; set; } public List ProductionLocations { get; set; } public List Taglines { get; set; } diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 8d2f19d4c1..c0afe3df9e 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities.Movies /// /// Class Movie /// - public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasSpecialFeatures, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasPreferredMetadataLanguage, IHasAwards, IHasMetascore, IHasLookupInfo, ISupportsBoxSetGrouping + public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasSpecialFeatures, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasAwards, IHasMetascore, IHasLookupInfo, ISupportsBoxSetGrouping { public List SpecialFeatureIds { get; set; } @@ -30,14 +30,6 @@ namespace MediaBrowser.Controller.Entities.Movies [IgnoreDataMember] public List BoxSetIdList { get; set; } - /// - /// Gets or sets the preferred metadata country code. - /// - /// The preferred metadata country code. - public string PreferredMetadataCountryCode { get; set; } - - public string PreferredMetadataLanguage { get; set; } - public Movie() { SpecialFeatureIds = new List(); diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 450555b3df..bbbf2358f0 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -12,19 +12,12 @@ namespace MediaBrowser.Controller.Entities /// /// Class Trailer /// - public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasPreferredMetadataLanguage, IHasMetascore, IHasLookupInfo + public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasMetascore, IHasLookupInfo { public List SoundtrackIds { get; set; } - public string PreferredMetadataLanguage { get; set; } public List ProductionLocations { get; set; } - /// - /// Gets or sets the preferred metadata country code. - /// - /// The preferred metadata country code. - public string PreferredMetadataCountryCode { get; set; } - public Trailer() { RemoteTrailers = new List(); diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 0b22d639e2..6550f43b43 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -25,6 +25,7 @@ namespace MediaBrowser.Controller.Entities ISupportsPlaceHolders, IHasMediaSources, IHasShortOverview, + IHasPreferredMetadataLanguage, IThemeMedia { public bool IsMultiPart { get; set; } @@ -43,6 +44,13 @@ namespace MediaBrowser.Controller.Entities public string ShortOverview { get; set; } public ExtraType ExtraType { get; set; } + /// + /// Gets or sets the preferred metadata country code. + /// + /// The preferred metadata country code. + public string PreferredMetadataCountryCode { get; set; } + public string PreferredMetadataLanguage { get; set; } + /// /// Gets or sets the timestamp. /// diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index f2fa912cad..df118b25fe 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -50,6 +50,11 @@ namespace MediaBrowser.Controller.LiveTv } } + public override bool IsSaveLocalMetadataEnabled() + { + return true; + } + /// /// Gets or sets the number. /// diff --git a/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs b/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs index 31bb7c66be..83e404dfce 100644 --- a/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs +++ b/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs @@ -1,10 +1,11 @@ using ServiceStack.Web; using System; +using System.Collections.Generic; using System.Linq; namespace MediaBrowser.Controller.Net { - public class AuthenticatedAttribute : Attribute, IHasRequestFilter + public class AuthenticatedAttribute : Attribute, IHasRequestFilter, IAuthenticated { public IAuthService AuthService { get; set; } @@ -14,8 +15,18 @@ namespace MediaBrowser.Controller.Net /// true if [allow local]; otherwise, false. public bool AllowLocal { get; set; } + /// + /// Gets or sets the roles. + /// + /// The roles. public string Roles { get; set; } + /// + /// Gets or sets a value indicating whether [escape parental control]. + /// + /// true if [escape parental control]; otherwise, false. + public bool EscapeParentalControl { get; set; } + /// /// The request filter is executed before the service. /// @@ -24,11 +35,7 @@ namespace MediaBrowser.Controller.Net /// The request DTO public void RequestFilter(IRequest request, IResponse response, object requestDto) { - var roles = (Roles ?? string.Empty).Split(',') - .Where(i => !string.IsNullOrWhiteSpace(i)) - .ToArray(); - - AuthService.Authenticate(request, response, requestDto, AllowLocal, roles); + AuthService.Authenticate(request, response, requestDto, this); } /// @@ -50,5 +57,20 @@ namespace MediaBrowser.Controller.Net { get { return 0; } } + + + public IEnumerable GetRoles() + { + return (Roles ?? string.Empty).Split(',') + .Where(i => !string.IsNullOrWhiteSpace(i)); + } + } + + public interface IAuthenticated + { + bool EscapeParentalControl { get; } + + bool AllowLocal { get; } + IEnumerable GetRoles(); } } diff --git a/MediaBrowser.Controller/Net/IAuthService.cs b/MediaBrowser.Controller/Net/IAuthService.cs index 69014d0ff1..9d335566ff 100644 --- a/MediaBrowser.Controller/Net/IAuthService.cs +++ b/MediaBrowser.Controller/Net/IAuthService.cs @@ -1,5 +1,4 @@ using ServiceStack.Web; -using System.Collections.Generic; namespace MediaBrowser.Controller.Net { @@ -8,7 +7,6 @@ namespace MediaBrowser.Controller.Net void Authenticate(IRequest request, IResponse response, object requestDto, - bool allowLocal, - string[] roles); + IAuthenticated authAttribtues); } } diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs index f7bd439a33..75e1bbde71 100644 --- a/MediaBrowser.Controller/Playlists/Playlist.cs +++ b/MediaBrowser.Controller/Playlists/Playlist.cs @@ -33,6 +33,11 @@ namespace MediaBrowser.Controller.Playlists } } + public override bool IsSaveLocalMetadataEnabled() + { + return true; + } + public override IEnumerable GetChildren(User user, bool includeLinkedChildren) { return GetPlayableItems(user); -- cgit v1.2.3