From a7a5933b93a3e1f34b90179c23ba5e33ed871154 Mon Sep 17 00:00:00 2001 From: Philippe Larose <philippe.larose@savoirfairelinux.com> Date: Fri, 6 Sep 2024 12:59:01 -0400 Subject: [PATCH] ad-connector: fix all users revoked when AD is down Fix f037a08d didn't work for active directory since UserProfileService.getUserProfile returns an empty array instead of null for Active Directory. In this case we must also check for an empty array in order to identify that the AD server is down. Ticket: https://redmine.savoirfairelinux.com/issues/7656 Change-Id: Icda219ec5f85b5b40e7a0c56957b2eb1dcd4f866 --- .../net/jami/jams/ad/connector/service/UserProfileService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ad-connector/src/main/java/net/jami/jams/ad/connector/service/UserProfileService.java b/ad-connector/src/main/java/net/jami/jams/ad/connector/service/UserProfileService.java index 39685be4..dd6e6495 100644 --- a/ad-connector/src/main/java/net/jami/jams/ad/connector/service/UserProfileService.java +++ b/ad-connector/src/main/java/net/jami/jams/ad/connector/service/UserProfileService.java @@ -203,7 +203,7 @@ public class UserProfileService { List<UserProfile> profilesFromAD = getUserProfile("*", "LOGON_NAME", false, Optional.empty()); // Do not revoke users if there is an error, the AD server could be down. - if (profilesFromAD != null) { + if (profilesFromAD != null && !profilesFromAD.isEmpty()) { // There is a use case where a user is not in the AD server but is in the database. // When this happens, we need to revoke the user from the database. List<UserProfile> profilesFromDatabase = -- GitLab