Merge pull request #7693 from crobibero/auth-migrate
(cherry picked from commit 3229ba4918cb31913b47c99c5a817dae3366f020) Signed-off-by: crobibero <cody@robibe.ro>
This commit is contained in:
parent
2b1a915ead
commit
abd3f411bd
|
@ -5,6 +5,7 @@ using Emby.Server.Implementations.Data;
|
||||||
using Jellyfin.Data.Entities.Security;
|
using Jellyfin.Data.Entities.Security;
|
||||||
using Jellyfin.Server.Implementations;
|
using Jellyfin.Server.Implementations;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using SQLitePCL.pretty;
|
using SQLitePCL.pretty;
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
private readonly ILogger<MigrateAuthenticationDb> _logger;
|
private readonly ILogger<MigrateAuthenticationDb> _logger;
|
||||||
private readonly JellyfinDbProvider _dbProvider;
|
private readonly JellyfinDbProvider _dbProvider;
|
||||||
private readonly IServerApplicationPaths _appPaths;
|
private readonly IServerApplicationPaths _appPaths;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="MigrateAuthenticationDb"/> class.
|
/// Initializes a new instance of the <see cref="MigrateAuthenticationDb"/> class.
|
||||||
|
@ -27,11 +29,17 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <param name="dbProvider">The database provider.</param>
|
/// <param name="dbProvider">The database provider.</param>
|
||||||
/// <param name="appPaths">The server application paths.</param>
|
/// <param name="appPaths">The server application paths.</param>
|
||||||
public MigrateAuthenticationDb(ILogger<MigrateAuthenticationDb> logger, JellyfinDbProvider dbProvider, IServerApplicationPaths appPaths)
|
/// <param name="userManager">The user manager.</param>
|
||||||
|
public MigrateAuthenticationDb(
|
||||||
|
ILogger<MigrateAuthenticationDb> logger,
|
||||||
|
JellyfinDbProvider dbProvider,
|
||||||
|
IServerApplicationPaths appPaths,
|
||||||
|
IUserManager userManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_dbProvider = dbProvider;
|
_dbProvider = dbProvider;
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
|
_userManager = userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -74,6 +82,14 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var userId = new Guid(row[6].ToString());
|
||||||
|
var user = _userManager.GetUserById(userId);
|
||||||
|
if (user is null)
|
||||||
|
{
|
||||||
|
// User doesn't exist, don't bring over the device.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
dbContext.Devices.Add(new Device(
|
dbContext.Devices.Add(new Device(
|
||||||
new Guid(row[6].ToString()),
|
new Guid(row[6].ToString()),
|
||||||
row[3].ToString(),
|
row[3].ToString(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user