|
|
@ -220,7 +220,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public void DeleteUser(Guid userId)
|
|
|
|
public async Task DeleteUserAsync(Guid userId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!_users.TryGetValue(userId, out var user))
|
|
|
|
if (!_users.TryGetValue(userId, out var user))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -246,7 +246,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|
|
|
nameof(userId));
|
|
|
|
nameof(userId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
using var dbContext = _dbProvider.CreateContext();
|
|
|
|
await using var dbContext = _dbProvider.CreateContext();
|
|
|
|
|
|
|
|
|
|
|
|
// Clear all entities related to the user from the database.
|
|
|
|
// Clear all entities related to the user from the database.
|
|
|
|
if (user.ProfileImage != null)
|
|
|
|
if (user.ProfileImage != null)
|
|
|
@ -258,10 +258,10 @@ namespace Jellyfin.Server.Implementations.Users
|
|
|
|
dbContext.RemoveRange(user.Preferences);
|
|
|
|
dbContext.RemoveRange(user.Preferences);
|
|
|
|
dbContext.RemoveRange(user.AccessSchedules);
|
|
|
|
dbContext.RemoveRange(user.AccessSchedules);
|
|
|
|
dbContext.Users.Remove(user);
|
|
|
|
dbContext.Users.Remove(user);
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
|
|
|
_users.Remove(userId);
|
|
|
|
_users.Remove(userId);
|
|
|
|
|
|
|
|
|
|
|
|
_eventManager.Publish(new UserDeletedEventArgs(user));
|
|
|
|
await _eventManager.PublishAsync(new UserDeletedEventArgs(user)).ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
/// <inheritdoc/>
|
|
|
|