aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-10-14 20:05:09 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-10-14 20:05:09 -0400
commitbd1bd5e87e1744b363279577a6550afc5f2229c1 (patch)
treedcee85b1a7e0d3243702a6df6cc422f45609870f /MediaBrowser.Server.Implementations
parent52776df0129f73f7d0f87e9c51629241c5c4a7de (diff)
fixes #552 - Add parental control usage limits
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/Connect/ConnectManager.cs1
-rw-r--r--MediaBrowser.Server.Implementations/Dto/DtoService.cs34
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs14
-rw-r--r--MediaBrowser.Server.Implementations/Library/UserManager.cs1
-rw-r--r--MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json5
-rw-r--r--MediaBrowser.Server.Implementations/Localization/Server/server.json9
6 files changed, 35 insertions, 29 deletions
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"
}