Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVDOC01-155: Correccions de codi i logs #31

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading