fix user policy serialization

This commit is contained in:
Luke Pulverenti 2014-12-22 02:00:40 -05:00
parent 498b58aad0
commit fef1d16cec
2 changed files with 6 additions and 6 deletions

View File

@ -89,7 +89,7 @@ namespace MediaBrowser.Model.Configuration
public string[] LatestItemsExcludes { get; set; }
public string[] BlockedTags { get; set; }
public bool ValuesMigratedToPolicy { get; set; }
public bool HasMigratedToPolicy { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.

View File

@ -293,7 +293,7 @@ namespace MediaBrowser.Server.Implementations.Library
private async Task DoPolicyMigration(User user)
{
if (!user.Configuration.ValuesMigratedToPolicy)
if (!user.Configuration.HasMigratedToPolicy)
{
user.Policy.AccessSchedules = user.Configuration.AccessSchedules;
user.Policy.BlockedChannels = user.Configuration.BlockedChannels;
@ -314,7 +314,7 @@ namespace MediaBrowser.Server.Implementations.Library
await UpdateUserPolicy(user.Id.ToString("N"), user.Policy);
user.Configuration.ValuesMigratedToPolicy = true;
user.Configuration.HasMigratedToPolicy = true;
await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false);
}
}
@ -800,7 +800,7 @@ namespace MediaBrowser.Server.Implementations.Library
{
lock (_policySyncLock)
{
return (UserPolicy)_jsonSerializer.DeserializeFromFile(typeof(UserPolicy), path);
return (UserPolicy)_xmlSerializer.DeserializeFromFile(typeof(UserPolicy), path);
}
}
catch (FileNotFoundException)
@ -842,7 +842,7 @@ namespace MediaBrowser.Server.Implementations.Library
lock (_policySyncLock)
{
_jsonSerializer.SerializeToFile(userPolicy, path);
_xmlSerializer.SerializeToFile(userPolicy, path);
user.Policy = userPolicy;
}
@ -881,7 +881,7 @@ namespace MediaBrowser.Server.Implementations.Library
private string GetPolifyFilePath(User user)
{
return Path.Combine(user.ConfigurationDirectoryPath, "policy.json");
return Path.Combine(user.ConfigurationDirectoryPath, "policy.xml");
}
private string GetConfigurationFilePath(User user)