aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Devices
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2015-10-26 18:50:19 -0400
committerLuke <luke.pulverenti@gmail.com>2015-10-26 18:50:19 -0400
commit35778ebc02e5931142a1fe31a256b7488a07c5c2 (patch)
treeced0290be8820f5e507b51ca4c5165212b1879d1 /MediaBrowser.Server.Implementations/Devices
parentc0dc8d055bfd4d2f58591083beb9e9128357aad6 (diff)
parent8d77308593c3b16b733b0109323770d9dfe7e166 (diff)
Merge pull request #1222 from MediaBrowser/dev
3.0.5768.7
Diffstat (limited to 'MediaBrowser.Server.Implementations/Devices')
-rw-r--r--MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs8
-rw-r--r--MediaBrowser.Server.Implementations/Devices/DeviceManager.cs10
-rw-r--r--MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs9
3 files changed, 19 insertions, 8 deletions
diff --git a/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs b/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs
index 566f4c5f40..6d7265972f 100644
--- a/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs
+++ b/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs
@@ -3,6 +3,8 @@ using MediaBrowser.Controller.Entities;
using System;
using System.IO;
using System.Linq;
+using CommonIO;
+using MediaBrowser.Common.IO;
namespace MediaBrowser.Server.Implementations.Devices
{
@@ -51,17 +53,19 @@ namespace MediaBrowser.Server.Implementations.Devices
public class CameraUploadsDynamicFolder : IVirtualFolderCreator
{
private readonly IApplicationPaths _appPaths;
+ private readonly IFileSystem _fileSystem;
- public CameraUploadsDynamicFolder(IApplicationPaths appPaths)
+ public CameraUploadsDynamicFolder(IApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
+ _fileSystem = fileSystem;
}
public BasePluginFolder GetFolder()
{
var path = Path.Combine(_appPaths.DataPath, "camerauploads");
- Directory.CreateDirectory(path);
+ _fileSystem.CreateDirectory(path);
return new CameraUploadsFolder
{
diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs
index 0173f27847..0b2c082a85 100644
--- a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs
+++ b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs
@@ -17,6 +17,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using CommonIO;
namespace MediaBrowser.Server.Implementations.Devices
{
@@ -157,7 +158,7 @@ namespace MediaBrowser.Server.Implementations.Devices
_libraryMonitor.ReportFileSystemChangeBeginning(path);
- Directory.CreateDirectory(Path.GetDirectoryName(path));
+ _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
try
{
@@ -264,6 +265,11 @@ namespace MediaBrowser.Server.Implementations.Devices
return true;
}
+ if (policy.IsAdministrator)
+ {
+ return true;
+ }
+
return ListHelper.ContainsIgnoreCase(policy.EnabledDevices, id);
}
}
@@ -290,4 +296,4 @@ namespace MediaBrowser.Server.Implementations.Devices
return config.GetConfiguration<DevicesOptions>("devices");
}
}
-}
+} \ No newline at end of file
diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs
index 6d324b1abe..43b1e693cc 100644
--- a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs
+++ b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs
@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using CommonIO;
namespace MediaBrowser.Server.Implementations.Devices
{
@@ -47,7 +48,7 @@ namespace MediaBrowser.Server.Implementations.Devices
public Task SaveDevice(DeviceInfo device)
{
var path = Path.Combine(GetDevicePath(device.Id), "device.json");
- Directory.CreateDirectory(Path.GetDirectoryName(path));
+ _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_syncLock)
{
@@ -111,8 +112,8 @@ namespace MediaBrowser.Server.Implementations.Devices
try
{
- return Directory
- .EnumerateFiles(path, "*", SearchOption.AllDirectories)
+ return _fileSystem
+ .GetFilePaths(path, true)
.Where(i => string.Equals(Path.GetFileName(i), "device.json", StringComparison.OrdinalIgnoreCase))
.ToList()
.Select(i =>
@@ -178,7 +179,7 @@ namespace MediaBrowser.Server.Implementations.Devices
public void AddCameraUpload(string deviceId, LocalFileInfo file)
{
var path = Path.Combine(GetDevicePath(deviceId), "camerauploads.json");
- Directory.CreateDirectory(Path.GetDirectoryName(path));
+ _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
lock (_syncLock)
{