Skip to content

Commit

Permalink
squash
Browse files Browse the repository at this point in the history
  • Loading branch information
mollerentornos committed Sep 13, 2024
1 parent 63f79ef commit 2c89d2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1023,8 +1023,8 @@ public boolean addMemberToTeam(String userId, String teamId) throws MicrosoftCre
getGraphClient().teams(teamId).members().buildRequest().post(conversationMember);
}catch(MicrosoftCredentialsException e) {
throw e;
}catch (Exception e) {
log.debug("Error adding owner userId={} to teamId={}", userId, teamId);
} catch (Exception e) {
log.debug("Error adding member userId={} to teamId={}", userId, teamId);
return false;
}
return true;
Expand Down Expand Up @@ -1098,6 +1098,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 @@ -1799,6 +1801,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 @@ -981,12 +981,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 @@ -997,12 +991,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;
}
}
}
ret = microsoftCommonService.addUsersToChannel(ss, gs, owners, ret, new LinkedList<>(Collections.singletonList(MicrosoftUser.OWNER)));
Expand Down

0 comments on commit 2c89d2a

Please sign in to comment.