diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index d455290be..ca54249b3 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -321,6 +321,20 @@ namespace MediaBrowser.Api.Images { var fileInfo = new FileInfo(info.Path); + int? width = null; + int? height = null; + + try + { + var size = _imageProcessor.GetImageSize(info.Path, info.DateModified); + + width = Convert.ToInt32(size.Width); + height = Convert.ToInt32(size.Height); + } + catch + { + + } return new ImageInfo { Path = info.Path, @@ -328,8 +342,8 @@ namespace MediaBrowser.Api.Images ImageType = info.Type, ImageTag = _imageProcessor.GetImageCacheTag(item, info), Size = fileInfo.Length, - Width = info.Width ?? 0, - Height = info.Height ?? 0 + Width = width, + Height = height }; } catch (Exception ex) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index d5296d7dc..0ecedcdda 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -564,6 +564,11 @@ namespace MediaBrowser.Controller.Entities return PlayAccess.None; } + //if (!user.IsParentalScheduleAllowed()) + //{ + // return PlayAccess.None; + //} + return PlayAccess.Full; } @@ -1465,8 +1470,6 @@ namespace MediaBrowser.Controller.Entities image.Path = file.FullName; image.DateModified = imageInfo.DateModified; - image.Width = imageInfo.Width; - image.Height = imageInfo.Height; } } @@ -1639,26 +1642,12 @@ namespace MediaBrowser.Controller.Entities private ItemImageInfo GetImageInfo(FileSystemInfo file, ImageType type) { - var info = new ItemImageInfo + return new ItemImageInfo { Path = file.FullName, Type = type, DateModified = FileSystem.GetLastWriteTimeUtc(file) }; - - try - { - var size = ImageProcessor.GetImageSize(info.Path); - - info.Width = Convert.ToInt32(size.Width); - info.Height = Convert.ToInt32(size.Height); - } - catch - { - - } - - return info; } /// diff --git a/MediaBrowser.Controller/Entities/ItemImageInfo.cs b/MediaBrowser.Controller/Entities/ItemImageInfo.cs index fe1f0598a..80aec6482 100644 --- a/MediaBrowser.Controller/Entities/ItemImageInfo.cs +++ b/MediaBrowser.Controller/Entities/ItemImageInfo.cs @@ -10,9 +10,5 @@ namespace MediaBrowser.Controller.Entities public ImageType Type { get; set; } public DateTime DateModified { get; set; } - - public int? Width { get; set; } - - public int? Height { get; set; } } } diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index 2275cbad4..6ba8701f7 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -6,6 +6,7 @@ using MediaBrowser.Model.Connect; using MediaBrowser.Model.Serialization; using System; using System.IO; +using System.Linq; using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; @@ -259,5 +260,41 @@ namespace MediaBrowser.Controller.Entities Configuration = config; UserManager.UpdateConfiguration(this, Configuration); } + + public bool IsParentalScheduleAllowed() + { + return IsParentalScheduleAllowed(DateTime.UtcNow); + } + + public bool IsParentalScheduleAllowed(DateTime date) + { + var schedules = Configuration.AccessSchedules; + + if (schedules.Length == 0) + { + return true; + } + + return schedules.Any(i => IsParentalScheduleAllowed(i, date)); + } + + private bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date) + { + if (date.Kind != DateTimeKind.Utc) + { + throw new ArgumentException("Utc date expected"); + } + + var localTime = date.ToLocalTime(); + + return localTime.DayOfWeek == schedule.DayOfWeek && IsWithinTime(schedule, localTime); + } + + private bool IsWithinTime(AccessSchedule schedule, DateTime localTime) + { + var hour = localTime.TimeOfDay.TotalHours; + + return hour >= schedule.StartHour && hour <= schedule.EndHour; + } } } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index dc9769d53..f4104b29d 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -129,6 +129,7 @@ namespace MediaBrowser.Controller.Entities public bool IsPlaceHolder { get; set; } public bool IsShortcut { get; set; } + public string ShortcutPath { get; set; } /// /// Gets or sets the tags. @@ -578,6 +579,28 @@ namespace MediaBrowser.Controller.Entities PlayableStreamFileNames = i.PlayableStreamFileNames.ToList() }; + if (i.IsShortcut) + { + info.Path = i.ShortcutPath; + + if (info.Path.StartsWith("Http", StringComparison.OrdinalIgnoreCase)) + { + info.Protocol = MediaProtocol.Http; + } + else if (info.Path.StartsWith("Rtmp", StringComparison.OrdinalIgnoreCase)) + { + info.Protocol = MediaProtocol.Rtmp; + } + else if (info.Path.StartsWith("Rtsp", StringComparison.OrdinalIgnoreCase)) + { + info.Protocol = MediaProtocol.Rtsp; + } + else + { + info.Protocol = MediaProtocol.File; + } + } + if (string.IsNullOrEmpty(info.Container)) { if (i.VideoType == VideoType.VideoFile || i.VideoType == VideoType.Iso) diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index a49d00e87..8ae605b62 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -99,7 +99,6 @@ - diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs index b6732456b..28aebae79 100644 --- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs +++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs @@ -869,22 +869,19 @@ namespace MediaBrowser.Dlna.Didl } - int? width = imageInfo.Width; - int? height = imageInfo.Height; + int? width = null; + int? height = null; - if (!height.HasValue && !width.HasValue) + try { - try - { - var size = _imageProcessor.GetImageSize(imageInfo.Path, imageInfo.DateModified); + var size = _imageProcessor.GetImageSize(imageInfo.Path, imageInfo.DateModified); - width = Convert.ToInt32(size.Width); - height = Convert.ToInt32(size.Height); - } - catch - { + width = Convert.ToInt32(size.Width); + height = Convert.ToInt32(size.Height); + } + catch + { - } } return new ImageDownloadInfo diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index dfd5eb2bb..3a62522c6 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -158,6 +158,9 @@ Collections\CollectionCreationResult.cs + + Configuration\AccessSchedule.cs + Configuration\BaseApplicationConfiguration.cs @@ -215,9 +218,27 @@ Configuration\XbmcMetadataOptions.cs + + Connect\ConnectAuthenticationResult.cs + Connect\ConnectAuthorization.cs + + Connect\ConnectUser.cs + + + Connect\ConnectUserQuery.cs + + + Connect\PinCreationResult.cs + + + Connect\PinExchangeResult.cs + + + Connect\PinStatusResult.cs + Connect\UserLinkType.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index c8ac202ab..c7b3b5ed2 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -124,6 +124,9 @@ Collections\CollectionCreationResult.cs + + Configuration\AccessSchedule.cs + Configuration\BaseApplicationConfiguration.cs @@ -181,9 +184,27 @@ Configuration\XbmcMetadataOptions.cs + + Connect\ConnectAuthenticationResult.cs + Connect\ConnectAuthorization.cs + + Connect\ConnectUser.cs + + + Connect\ConnectUserQuery.cs + + + Connect\PinCreationResult.cs + + + Connect\PinExchangeResult.cs + + + Connect\PinStatusResult.cs + Connect\UserLinkType.cs diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index 13088945a..8a777d3a2 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -715,10 +715,10 @@ namespace MediaBrowser.Model.ApiClient /// Authenticates a user and returns the result /// /// The username. - /// The sha1 hash. + /// The password. /// Task. /// userId - Task AuthenticateUserAsync(string username, byte[] sha1Hash); + Task AuthenticateUserAsync(string username, string password); /// /// Updates the server configuration async. diff --git a/MediaBrowser.Model/ApiClient/IConnectionManager.cs b/MediaBrowser.Model/ApiClient/IConnectionManager.cs index d76ef67d2..627ce74ca 100644 --- a/MediaBrowser.Model/ApiClient/IConnectionManager.cs +++ b/MediaBrowser.Model/ApiClient/IConnectionManager.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Connect; +using MediaBrowser.Model.Dto; using MediaBrowser.Model.Events; using System; using System.Threading; @@ -65,5 +66,25 @@ namespace MediaBrowser.Model.ApiClient /// [Obsolete] IApiClient CurrentApiClient { get; } + + /// + /// Creates the pin. + /// + /// Task<PinCreationResult>. + Task CreatePin(); + + /// + /// Gets the pin status. + /// + /// The pin. + /// Task<PinStatusResult>. + Task GetPinStatus(PinCreationResult pin); + + /// + /// Exchanges the pin. + /// + /// The pin. + /// Task. + Task ExchangePin(PinCreationResult pin); } } diff --git a/MediaBrowser.Model/Configuration/AccessSchedule.cs b/MediaBrowser.Model/Configuration/AccessSchedule.cs new file mode 100644 index 000000000..65f2f6291 --- /dev/null +++ b/MediaBrowser.Model/Configuration/AccessSchedule.cs @@ -0,0 +1,23 @@ +using System; + +namespace MediaBrowser.Model.Configuration +{ + public class AccessSchedule + { + /// + /// Gets or sets the day of week. + /// + /// The day of week. + public DayOfWeek DayOfWeek { get; set; } + /// + /// Gets or sets the start hour. + /// + /// The start hour. + public double StartHour { get; set; } + /// + /// Gets or sets the end hour. + /// + /// The end hour. + public double EndHour { get; set; } + } +} diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs index 46eb0c733..c162e389b 100644 --- a/MediaBrowser.Model/Configuration/UserConfiguration.cs +++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs @@ -66,7 +66,7 @@ namespace MediaBrowser.Model.Configuration public string[] BlockedChannels { get; set; } public string[] DisplayChannelsWithinViews { get; set; } - + public string[] ExcludeFoldersFromGrouping { get; set; } public UnratedItem[] BlockUnratedItems { get; set; } @@ -86,13 +86,14 @@ namespace MediaBrowser.Model.Configuration public bool EnableCinemaMode { get; set; } + public AccessSchedule[] AccessSchedules { get; set; } + /// /// Initializes a new instance of the class. /// public UserConfiguration() { PlayDefaultAudioTrack = true; - EnableRemoteControlOfOtherUsers = true; EnableLiveTvManagement = true; EnableMediaPlayback = true; EnableLiveTvAccess = true; @@ -111,6 +112,8 @@ namespace MediaBrowser.Model.Configuration SyncConnectImage = true; IncludeTrailersInSuggestions = true; EnableCinemaMode = true; + + AccessSchedules = new AccessSchedule[] { }; } } } diff --git a/MediaBrowser.Model/Connect/ConnectAuthenticationResult.cs b/MediaBrowser.Model/Connect/ConnectAuthenticationResult.cs new file mode 100644 index 000000000..4dcbf6904 --- /dev/null +++ b/MediaBrowser.Model/Connect/ConnectAuthenticationResult.cs @@ -0,0 +1,17 @@ + +namespace MediaBrowser.Model.Connect +{ + public class ConnectAuthenticationResult + { + /// + /// Gets or sets the user identifier. + /// + /// The user identifier. + public string UserId { get; set; } + /// + /// Gets or sets the access token. + /// + /// The access token. + public string AccessToken { get; set; } + } +} diff --git a/MediaBrowser.Controller/Connect/ConnectUser.cs b/MediaBrowser.Model/Connect/ConnectUser.cs similarity index 55% rename from MediaBrowser.Controller/Connect/ConnectUser.cs rename to MediaBrowser.Model/Connect/ConnectUser.cs index c6a9eba55..da290da12 100644 --- a/MediaBrowser.Controller/Connect/ConnectUser.cs +++ b/MediaBrowser.Model/Connect/ConnectUser.cs @@ -1,5 +1,5 @@  -namespace MediaBrowser.Controller.Connect +namespace MediaBrowser.Model.Connect { public class ConnectUser { @@ -9,11 +9,4 @@ namespace MediaBrowser.Controller.Connect public bool IsActive { get; set; } public string ImageUrl { get; set; } } - - public class ConnectUserQuery - { - public string Id { get; set; } - public string Name { get; set; } - public string Email { get; set; } - } } diff --git a/MediaBrowser.Model/Connect/ConnectUserQuery.cs b/MediaBrowser.Model/Connect/ConnectUserQuery.cs new file mode 100644 index 000000000..e5ab534ea --- /dev/null +++ b/MediaBrowser.Model/Connect/ConnectUserQuery.cs @@ -0,0 +1,10 @@ + +namespace MediaBrowser.Model.Connect +{ + public class ConnectUserQuery + { + public string Id { get; set; } + public string Name { get; set; } + public string Email { get; set; } + } +} diff --git a/MediaBrowser.Model/Connect/PinCreationResult.cs b/MediaBrowser.Model/Connect/PinCreationResult.cs new file mode 100644 index 000000000..c96e92049 --- /dev/null +++ b/MediaBrowser.Model/Connect/PinCreationResult.cs @@ -0,0 +1,11 @@ + +namespace MediaBrowser.Model.Connect +{ + public class PinCreationResult + { + public string Pin { get; set; } + public string DeviceId { get; set; } + public bool IsConfirmed { get; set; } + public bool IsExpired { get; set; } + } +} diff --git a/MediaBrowser.Model/Connect/PinExchangeResult.cs b/MediaBrowser.Model/Connect/PinExchangeResult.cs new file mode 100644 index 000000000..dfe995ce6 --- /dev/null +++ b/MediaBrowser.Model/Connect/PinExchangeResult.cs @@ -0,0 +1,10 @@ +using System; + +namespace MediaBrowser.Model.Connect +{ + public class PinExchangeResult + { + public string UserId { get; set; } + public string UserAccessToken { get; set; } + } +} diff --git a/MediaBrowser.Model/Connect/PinStatusResult.cs b/MediaBrowser.Model/Connect/PinStatusResult.cs new file mode 100644 index 000000000..de60c463d --- /dev/null +++ b/MediaBrowser.Model/Connect/PinStatusResult.cs @@ -0,0 +1,10 @@ + +namespace MediaBrowser.Model.Connect +{ + public class PinStatusResult + { + public string Pin { get; set; } + public bool IsConfirmed { get; set; } + public bool IsExpired { get; set; } + } +} diff --git a/MediaBrowser.Model/Dto/ImageInfo.cs b/MediaBrowser.Model/Dto/ImageInfo.cs index fa3a38fcb..5eabb16a5 100644 --- a/MediaBrowser.Model/Dto/ImageInfo.cs +++ b/MediaBrowser.Model/Dto/ImageInfo.cs @@ -1,5 +1,4 @@ using MediaBrowser.Model.Entities; -using System; namespace MediaBrowser.Model.Dto { @@ -35,13 +34,13 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the height. /// /// The height. - public int Height { get; set; } + public int? Height { get; set; } /// /// Gets or sets the width. /// /// The width. - public int Width { get; set; } + public int? Width { get; set; } /// /// Gets or sets the size. diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index fa0c2d466..470b1dcaf 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -89,6 +89,7 @@ + @@ -96,7 +97,13 @@ + + + + + + diff --git a/MediaBrowser.Model/MediaInfo/MediaProtocol.cs b/MediaBrowser.Model/MediaInfo/MediaProtocol.cs index ad63fa058..880310814 100644 --- a/MediaBrowser.Model/MediaInfo/MediaProtocol.cs +++ b/MediaBrowser.Model/MediaInfo/MediaProtocol.cs @@ -4,6 +4,7 @@ namespace MediaBrowser.Model.MediaInfo { File = 0, Http = 1, - Rtmp = 2 + Rtmp = 2, + Rtsp = 3 } } \ No newline at end of file diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs index cc161803a..16c255397 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Configuration; +using System.IO; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.IO; using MediaBrowser.Controller.Chapters; using MediaBrowser.Controller.Configuration; @@ -132,16 +133,27 @@ namespace MediaBrowser.Providers.MediaInfo return _cachedTask; } - if (item.IsPlaceHolder || item.IsShortcut) + if (item.IsPlaceHolder) { return _cachedTask; } + if (item.IsShortcut) + { + FetchShortcutInfo(item); + return Task.FromResult(ItemUpdateType.MetadataEdit); + } + var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager, _chapterManager); return prober.ProbeVideo(item, options, cancellationToken); } + private void FetchShortcutInfo(Video video) + { + video.ShortcutPath = File.ReadAllText(video.Path); + } + public Task FetchAudioInfo(T item, CancellationToken cancellationToken) where T : Audio { diff --git a/MediaBrowser.Providers/Photos/PhotoProvider.cs b/MediaBrowser.Providers/Photos/PhotoProvider.cs index fe6289766..29b75d830 100644 --- a/MediaBrowser.Providers/Photos/PhotoProvider.cs +++ b/MediaBrowser.Providers/Photos/PhotoProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Drawing; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; @@ -17,10 +18,12 @@ namespace MediaBrowser.Providers.Photos public class PhotoProvider : ICustomMetadataProvider, IHasItemChangeMonitor { private readonly ILogger _logger; + private readonly IImageProcessor _imageProcessor; - public PhotoProvider(ILogger logger) + public PhotoProvider(ILogger logger, IImageProcessor imageProcessor) { _logger = logger; + _imageProcessor = imageProcessor; } public Task FetchAsync(Photo item, MetadataRefreshOptions options, CancellationToken cancellationToken) @@ -140,9 +143,18 @@ namespace MediaBrowser.Providers.Photos } var imageInfo = item.GetImageInfo(ImageType.Primary, 0); + + try + { + var size = _imageProcessor.GetImageSize(imageInfo.Path, imageInfo.DateModified); - item.Height = imageInfo.Height; - item.Width = imageInfo.Width; + item.Width = Convert.ToInt32(size.Width); + item.Height = Convert.ToInt32(size.Height); + } + catch + { + + } const ItemUpdateType result = ItemUpdateType.ImageUpdate | ItemUpdateType.MetadataImport; return Task.FromResult(result); diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs index 40d911979..2a006b677 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs @@ -634,6 +634,7 @@ namespace MediaBrowser.Server.Implementations.Connect user.Configuration.SyncConnectImage = true; user.Configuration.SyncConnectName = true; + user.Configuration.IsHidden = true; _userManager.UpdateConfiguration(user, user.Configuration); } diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index c2ac386eb..366a5558b 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1429,35 +1429,21 @@ namespace MediaBrowser.Server.Implementations.Dto // See if we can avoid a file system lookup by looking for the file in ResolveArgs var dateModified = imageInfo.DateModified; - double? width = imageInfo.Width; - double? height = imageInfo.Height; - ImageSize size; - if (!width.HasValue || !height.HasValue) + try { - try - { - size = _imageProcessor.GetImageSize(path, dateModified); - } - catch (FileNotFoundException) - { - _logger.Error("Image file does not exist: {0}", path); - return; - } - catch (Exception ex) - { - _logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path); - return; - } + size = _imageProcessor.GetImageSize(path, dateModified); } - else + catch (FileNotFoundException) { - size = new ImageSize - { - Height = height.Value, - Width = width.Value - }; + _logger.Error("Image file does not exist: {0}", path); + return; + } + catch (Exception ex) + { + _logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path); + return; } dto.OriginalPrimaryImageAspectRatio = size.Width / size.Height; diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs index cae2cead4..ac8e37902 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs @@ -67,7 +67,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security { if (!_config.Configuration.InsecureApps.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase)) { - //SessionManager.ValidateSecurityToken(auth.Token); + SessionManager.ValidateSecurityToken(auth.Token); } } @@ -80,9 +80,17 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security throw new ArgumentException("User with Id " + auth.UserId + " not found"); } - if (user != null && user.Configuration.IsDisabled) + if (user != null) { - throw new AuthenticationException("User account has been disabled."); + if (user.Configuration.IsDisabled) + { + throw new AuthenticationException("User account has been disabled."); + } + + if (!user.Configuration.IsAdministrator && !user.IsParentalScheduleAllowed()) + { + throw new AuthenticationException("This user account is not allowed access at this time."); + } } if (roles.Contains("admin", StringComparer.OrdinalIgnoreCase)) diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index e76bc4f80..bb52fe35e 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -234,6 +234,7 @@ namespace MediaBrowser.Server.Implementations.Library users.Add(user); user.Configuration.IsAdministrator = true; + user.Configuration.EnableRemoteControlOfOtherUsers = true; UpdateConfiguration(user, user.Configuration); } diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index ec275c8dc..0611114e3 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -609,5 +609,8 @@ "DeleteDeviceConfirmation": "Are you sure you wish to delete this device? It will reappear the next time a user signs in with it.", "LabelEnableCameraUploadFor": "Enable camera upload for:", "HeaderSelectUploadPath": "Select Upload Path", - "LabelEnableCameraUploadForHelp": "Uploads will occur automatically in the background when signed into Media Browser." + "LabelEnableCameraUploadForHelp": "Uploads will occur automatically in the background when signed into Media Browser.", + "ErrorMessageStartHourGreaterThanEnd": "End time must be greater than the start time.", + "ButtonLibraryAccess": "Library access", + "ButtonParentalControl": "Parental control" } diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 216cf87d6..2a56037b3 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -1235,5 +1235,12 @@ "HeaderGuests": "Guests", "HeaderLocalUsers": "Local Users", "HeaderPendingInvitations": "Pending Invitations", - "TabParentalControl": "Parental Control" + "TabParentalControl": "Parental Control", + "HeaderAccessSchedule": "Access Schedule", + "HeaderAccessScheduleHelp": "Create an access schedule to limit access to certain hours.", + "ButtonAddSchedule": "Add Schedule", + "LabelAccessDay": "Day of week:", + "LabelAccessStart": "Start time:", + "LabelAccessEnd": "End time:", + "HeaderSchedule": "Schedule" } diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 8d68f0c13..6f280c45a 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.482 + 3.0.484 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 90ae9dbac..95197afc6 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.482 + 3.0.484 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec index 90f107af9..4264b2850 100644 --- a/Nuget/MediaBrowser.Model.Signed.nuspec +++ b/Nuget/MediaBrowser.Model.Signed.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Model.Signed - 3.0.482 + 3.0.484 MediaBrowser.Model - Signed Edition Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 545f52e2c..2820c4f9d 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.482 + 3.0.484 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +