mirror of
https://git.jami.net/savoirfairelinux/jami-jams.git
synced 2025-10-30 07:57:19 +08:00
ad-connector: fix user revocation
fixing a bug where users that should not be revoked are getting revoked automatically with Active Directory Ticket: https://redmine.savoirfairelinux.com/issues/7520 Change-Id: Icb7a0292eb195cdab6dec1af642211ca1ee69f09
This commit is contained in:
@ -133,20 +133,6 @@ public class UserProfileService {
|
||||
results.stream()
|
||||
.map(UserProfileService::profileFromResponse)
|
||||
.collect(Collectors.toList());
|
||||
// There is a use case where a user is not in the LDAP directory but is in the database.
|
||||
// When this happens, we need to revoke the user from the database.
|
||||
List<UserProfile> profilesFromDatabase =
|
||||
dataStore.getUserProfileDao().getAllUserProfile();
|
||||
for (UserProfile p : profilesFromDatabase) {
|
||||
if (profilesFromResponse.stream()
|
||||
.noneMatch(r -> r.getUsername().equals(p.getUsername()))) {
|
||||
RevokeUserFlow.revokeUser(p.getUsername());
|
||||
// We also remove the user from the local_directory table to avoid duplicate
|
||||
// revocations
|
||||
dataStore.getUserProfileDao().deleteUserProfile(p.getUsername());
|
||||
}
|
||||
}
|
||||
// Inserts the newly added profiles into the database.
|
||||
for (UserProfile p : profilesFromResponse) {
|
||||
dataStore.getUserProfileDao().insertIfNotExists(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user