Skip to content

Commit

Permalink
Fix MS Graph Group Sync
Browse files Browse the repository at this point in the history
Fix group parsing to only run on returned Group objects as the Graph call was also returning directory roles and admin units.

re: hkamel#120
  • Loading branch information
srvrguy committed Dec 6, 2022
1 parent 5ca09fd commit ba272cf
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/org/almrangers/auth/aad/AadUserInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,14 @@ Set<String> processMemberGroupCollection(@Nullable DirectoryObjectCollectionWith
while(memberGroupCollection != null) {
final List<DirectoryObject> groupList = memberGroupCollection.getCurrentPage();

for ( DirectoryObject group : groupList) {
String groupDisplayName = ((Group) group).displayName;

// Don't add the group if the display name is null
if(groupDisplayName != null) {
parsedUserGroups.add(groupDisplayName);
for (DirectoryObject group : groupList) {
if (group instanceof Group) {
String groupDisplayName = ((Group) group).displayName;

// Don't add the group if the display name is null
if (groupDisplayName != null) {
parsedUserGroups.add(groupDisplayName);
}
}
}

Expand Down

0 comments on commit ba272cf

Please sign in to comment.