aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
authorMichalis Adamidis <gsnerf@gsnerf.de>2014-09-14 18:00:44 +0200
committerMichalis Adamidis <gsnerf@gsnerf.de>2014-09-14 18:00:44 +0200
commit411a0531e0a71b2d458b5b3a8a9951ca763ca09a (patch)
tree871614a2cab9da0aa95d1d1f9f350d80fcf56271 /MediaBrowser.Controller/Entities
parent4f3ea6c6c3cdde7f4b8d21dc97c711635d73b4e0 (diff)
parent6a177d21478774b3ea1a5adc606935bb3aff65bf (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/User.cs33
1 files changed, 27 insertions, 6 deletions
diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs
index e4fd929ffd..c0c7a6c531 100644
--- a/MediaBrowser.Controller/Entities/User.cs
+++ b/MediaBrowser.Controller/Entities/User.cs
@@ -20,12 +20,22 @@ namespace MediaBrowser.Controller.Entities
public static IXmlSerializer XmlSerializer { get; set; }
/// <summary>
+ /// From now on all user paths will be Id-based.
+ /// This is for backwards compatibility.
+ /// </summary>
+ public bool UsesIdForConfigurationPath { get; set; }
+
+ /// <summary>
/// Gets or sets the password.
/// </summary>
/// <value>The password.</value>
public string Password { get; set; }
public string LocalPassword { get; set; }
+ public string ConnectUserName { get; set; }
+ public string ConnectUserId { get; set; }
+ public string ConnectAccessKey { get; set; }
+
/// <summary>
/// Gets or sets the path.
/// </summary>
@@ -136,12 +146,14 @@ namespace MediaBrowser.Controller.Entities
{
if (string.IsNullOrEmpty(newName))
{
- throw new ArgumentNullException();
+ throw new ArgumentNullException("newName");
}
// If only the casing is changing, leave the file system alone
- if (!newName.Equals(Name, StringComparison.OrdinalIgnoreCase))
+ if (!UsesIdForConfigurationPath && !newName.Equals(Name, StringComparison.OrdinalIgnoreCase))
{
+ UsesIdForConfigurationPath = true;
+
// Move configuration
var newConfigDirectory = GetConfigurationDirectoryPath(newName);
var oldConfigurationDirectory = ConfigurationDirectoryPath;
@@ -168,7 +180,8 @@ namespace MediaBrowser.Controller.Entities
{
ReplaceAllMetadata = true,
ImageRefreshMode = ImageRefreshMode.FullRefresh,
- MetadataRefreshMode = MetadataRefreshMode.FullRefresh
+ MetadataRefreshMode = MetadataRefreshMode.FullRefresh,
+ ForceSave = true
}, CancellationToken.None);
}
@@ -183,7 +196,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value>The configuration directory path.</value>
[IgnoreDataMember]
- public string ConfigurationDirectoryPath
+ private string ConfigurationDirectoryPath
{
get
{
@@ -203,9 +216,17 @@ namespace MediaBrowser.Controller.Entities
throw new ArgumentNullException("username");
}
- var safeFolderName = FileSystem.GetValidFilename(username);
+ var parentPath = ConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath;
+
+ // Legacy
+ if (!UsesIdForConfigurationPath)
+ {
+ var safeFolderName = FileSystem.GetValidFilename(username);
+
+ return System.IO.Path.Combine(ConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath, safeFolderName);
+ }
- return System.IO.Path.Combine(ConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath, safeFolderName);
+ return System.IO.Path.Combine(parentPath, Id.ToString("N"));
}
/// <summary>