From 34ac03c3525ffae3fc73860706b562c0f343830f Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Sun, 9 Mar 2025 21:46:16 +0000 Subject: [PATCH] Fix Plex user import to exclude users without server access Fixes #5064 Add a condition to filter out users without a `` entry in the `ImportPlexUsers` method. * Update the `ImportPlexUsers` method to check for the presence of a `` entry before importing a user. * Log a message when skipping a user due to lack of server access. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Ombi-app/Ombi/issues/5064?shareId=XXXX-XXXX-XXXX-XXXX). --- src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs b/src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs index 6c90dd20f..94445e6e0 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs @@ -143,6 +143,14 @@ namespace Ombi.Schedule.Jobs.Plex _log.LogWarning($"Cannot add user {plexUser.Username} because their email address is already in Ombi, skipping this user"); continue; } + + // Check if the user has a entry + if (plexUser.Server == null || !plexUser.Server.Any()) + { + _log.LogInformation($"Skipping user {plexUser.Username} because they do not have access to any servers."); + continue; + } + // Create this users // We do not store a password against the user since they will authenticate via Plex var newUser = new OmbiUser