Fix Plex user import to exclude users without server access

Fixes #5064

Add a condition to filter out users without a `<Server>` entry in the `ImportPlexUsers` method.

* Update the `ImportPlexUsers` method to check for the presence of a `<Server>` 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).
This commit is contained in:
Jamie Rees 2025-03-09 21:46:16 +00:00
commit 34ac03c352

View file

@ -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 <Server> 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