Skip to content

Commit

Permalink
fix(user-importer): šŸ› Fixed an issue where the cleanup wouldn't deletā€¦
Browse files Browse the repository at this point in the history
ā€¦e users #4812
  • Loading branch information
tidusjar committed Jul 3, 2023
1 parent 9840077 commit 46397cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Ombi.Core/Engine/UserDeletionEngine.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ļ»æusing Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.VisualBasic;
using Ombi.Core.Authentication;
using Ombi.Store.Entities;
using Ombi.Store.Entities.Requests;
Expand Down
9 changes: 6 additions & 3 deletions src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.Extensions.Logging;
using Ombi.Api.Plex;
using Ombi.Core.Authentication;
using Ombi.Core.Engine;
using Ombi.Core.Settings;
using Ombi.Core.Settings.Models.External;
using Ombi.Helpers;
Expand All @@ -20,14 +21,16 @@ namespace Ombi.Schedule.Jobs.Plex
public class PlexUserImporter : IPlexUserImporter
{
public PlexUserImporter(IPlexApi api, OmbiUserManager um, ILogger<PlexUserImporter> log,
ISettingsService<PlexSettings> plexSettings, ISettingsService<UserManagementSettings> ums, INotificationHubService notificationHubService)
ISettingsService<PlexSettings> plexSettings, ISettingsService<UserManagementSettings> ums, INotificationHubService notificationHubService,
IUserDeletionEngine userDeletionEngine)
{
_api = api;
_userManager = um;
_log = log;
_plexSettings = plexSettings;
_userManagementSettings = ums;
_notification = notificationHubService;
_userDeletionEngine = userDeletionEngine;
_plexSettings.ClearCache();
_userManagementSettings.ClearCache();
}
Expand All @@ -38,7 +41,7 @@ public PlexUserImporter(IPlexApi api, OmbiUserManager um, ILogger<PlexUserImport
private readonly ISettingsService<PlexSettings> _plexSettings;
private readonly ISettingsService<UserManagementSettings> _userManagementSettings;
private readonly INotificationHubService _notification;

private readonly IUserDeletionEngine _userDeletionEngine;

public async Task Execute(IJobExecutionContext job)
{
Expand Down Expand Up @@ -90,7 +93,7 @@ public async Task Execute(IJobExecutionContext job)
foreach (var ombiUser in missingUsers)
{
_log.LogInformation("Deleting user {0} not found in Plex Server.", ombiUser.UserName);
await _userManager.DeleteAsync(ombiUser);
await _userDeletionEngine.DeleteUser(ombiUser);
}
}

Expand Down

0 comments on commit 46397cb

Please sign in to comment.