|
|
@ -160,10 +160,25 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Users = await LoadUsers().ConfigureAwait(false);
|
|
|
|
Users = await LoadUsers().ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var user in Users.ToList())
|
|
|
|
var users = Users.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var user in users)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await DoPolicyMigration(user).ConfigureAwait(false);
|
|
|
|
await DoPolicyMigration(user).ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If there are no local users with admin rights, make them all admins
|
|
|
|
|
|
|
|
if (!users.Any(i => i.Policy.IsAdministrator))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var user in users)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!user.ConnectLinkType.HasValue || user.ConnectLinkType.Value == UserLinkType.LinkedUser)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
user.Policy.IsAdministrator = true;
|
|
|
|
|
|
|
|
await UpdateUserPolicy(user, user.Policy, false).ConfigureAwait(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Task<bool> AuthenticateUser(string username, string passwordSha1, string remoteEndPoint)
|
|
|
|
public Task<bool> AuthenticateUser(string username, string passwordSha1, string remoteEndPoint)
|
|
|
@ -331,7 +346,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
user.Policy.IsHidden = user.Configuration.IsHidden;
|
|
|
|
user.Policy.IsHidden = user.Configuration.IsHidden;
|
|
|
|
user.Policy.MaxParentalRating = user.Configuration.MaxParentalRating;
|
|
|
|
user.Policy.MaxParentalRating = user.Configuration.MaxParentalRating;
|
|
|
|
|
|
|
|
|
|
|
|
await UpdateUserPolicy(user.Id.ToString("N"), user.Policy);
|
|
|
|
await UpdateUserPolicy(user, user.Policy, false);
|
|
|
|
|
|
|
|
|
|
|
|
user.Configuration.HasMigratedToPolicy = true;
|
|
|
|
user.Configuration.HasMigratedToPolicy = true;
|
|
|
|
await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false);
|
|
|
|
await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false);
|
|
|
@ -867,12 +882,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
userPolicy = _jsonSerializer.DeserializeFromString<UserPolicy>(json);
|
|
|
|
userPolicy = _jsonSerializer.DeserializeFromString<UserPolicy>(json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var updateConfig = user.Policy.IsAdministrator != userPolicy.IsAdministrator ||
|
|
|
|
|
|
|
|
user.Policy.EnableLiveTvManagement != userPolicy.EnableLiveTvManagement ||
|
|
|
|
|
|
|
|
user.Policy.EnableLiveTvAccess != userPolicy.EnableLiveTvAccess ||
|
|
|
|
|
|
|
|
user.Policy.EnableMediaPlayback != userPolicy.EnableMediaPlayback ||
|
|
|
|
|
|
|
|
user.Policy.EnableContentDeletion != userPolicy.EnableContentDeletion;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var path = GetPolifyFilePath(user);
|
|
|
|
var path = GetPolifyFilePath(user);
|
|
|
|
|
|
|
|
|
|
|
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
|
|
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
|
|
@ -883,8 +892,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
user.Policy = userPolicy;
|
|
|
|
user.Policy = userPolicy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (updateConfig)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
user.Configuration.IsAdministrator = user.Policy.IsAdministrator;
|
|
|
|
user.Configuration.IsAdministrator = user.Policy.IsAdministrator;
|
|
|
|
user.Configuration.EnableLiveTvManagement = user.Policy.EnableLiveTvManagement;
|
|
|
|
user.Configuration.EnableLiveTvManagement = user.Policy.EnableLiveTvManagement;
|
|
|
|
user.Configuration.EnableLiveTvAccess = user.Policy.EnableLiveTvAccess;
|
|
|
|
user.Configuration.EnableLiveTvAccess = user.Policy.EnableLiveTvAccess;
|
|
|
@ -893,7 +900,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
|
|
|
|
|
|
|
|
await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false);
|
|
|
|
await UpdateConfiguration(user, user.Configuration, true).ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void DeleteUserPolicy(User user)
|
|
|
|
private void DeleteUserPolicy(User user)
|
|
|
|
{
|
|
|
|
{
|
|
|
|