Skip to content

Commit

Permalink
EVDOC01-155: Correccions de codi i logs (asicudl#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
mollerentornos authored and mateullas committed Oct 3, 2024
1 parent 8af4765 commit 7b62a5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ public boolean addMemberToTeam(String userId, String teamId) throws MicrosoftCre
} catch (MicrosoftCredentialsException e) {
throw e;
} catch (Exception e) {
log.debug("Error adding owner userId={} to teamId={}", userId, teamId);
log.debug("Error adding member userId={} to teamId={}", userId, teamId);
return false;
}
return true;
Expand Down Expand Up @@ -1109,6 +1109,8 @@ public SynchronizationStatus addUsersToTeamOrGroup(String teamId, List<Microsoft
status = (pendingMember != null && pendingMember.isGuest()) ? SynchronizationStatus.ERROR_GUEST : SynchronizationStatus.ERROR;
}

log.debug("Error adding {} userId={} to teamId={}", (roles.contains(MicrosoftUser.OWNER) && !Objects.requireNonNull(pendingMember).isGuest()) ? "owner" : "member", pendingMember.getId(), teamId);

// save log add member
microsoftLoggingRepository.save(MicrosoftLog.builder()
.event(MicrosoftLog.EVENT_ADD_MEMBER)
Expand Down Expand Up @@ -1810,6 +1812,8 @@ public SynchronizationStatus addUsersToChannel(SiteSynchronization ss, GroupSync
status = (pendingMember != null && pendingMember.isGuest()) ? SynchronizationStatus.ERROR_GUEST : SynchronizationStatus.ERROR;
}

log.debug("Error adding {} userId={} to teamId={} + channelId={}", (roles.contains(MicrosoftUser.OWNER) && !Objects.requireNonNull(pendingMember).isGuest()) ? "owner" : "member", pendingMember.getId(), teamId, channelId);

//save log
microsoftLoggingRepository.save(MicrosoftLog.builder()
.event(MicrosoftLog.EVENT_USER_ADDED_TO_CHANNEL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -988,12 +988,6 @@ private SynchronizationStatus runGroupSynchronization(SiteSynchronization ss, Gr

if (mu != null) {
members.add(mu);
//user exists -> add to channel
//IMPORTANT: all non-existent users in Site, have been invited. So, should be no users in Group that do not exist in Microsoft
//IMPORTANT 2: if user is just added to a group (because is guest/invited), maybe can not be added immediately to a channel
if (!addMemberToMicrosoftChannel(ss, gs, mu) && !ret.equals(SynchronizationStatus.ERROR)) {
ret = SynchronizationStatus.ERROR_GUEST;
}
}
}
ret = microsoftCommonService.addUsersToChannel(ss, gs, members, ret, new LinkedList<>());
Expand All @@ -1004,12 +998,6 @@ private SynchronizationStatus runGroupSynchronization(SiteSynchronization ss, Gr

if (mu != null) {
owners.add(mu);
//user exists -> add to channel
//IMPORTANT: all non-existent users in Site, have been invited. So, there are no users in Group that do not exist in Microsoft
//IMPORTANT 2: if user is just added to a group (because is guest/invited), maybe can not be added immediately to a channel
if (!addOwnerToMicrosoftChannel(ss, gs, mu) && !ret.equals(SynchronizationStatus.ERROR)) {
ret = SynchronizationStatus.ERROR_GUEST;
}
}
}

Expand Down

0 comments on commit 7b62a5f

Please sign in to comment.