Skip to content

Commit

Permalink
Export all group members that can be retrieved
Browse files Browse the repository at this point in the history
  • Loading branch information
dheavern committed Jan 30, 2020
1 parent a179c1f commit b2f2788
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions Source/DfBAdminToolkit/Presenter/GroupsPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ private void ExportGroups(IGroupsModel model, IMainPresenter presenter)
dynamic joinedOn = string.Empty;
dynamic accessType = string.Empty;

//You can only get member profile info from user managed groups
if (groupType == "user_managed")
// System_managed groups may not list all members
// Check to see if the object has a nonzero/null member list
if ((groupInfo["members"]?.Count ?? 0) != 0)
{
int memberCount = groupInfo["members"].Count;
for (int m = 0; m < memberCount; m++)
Expand Down Expand Up @@ -235,8 +236,7 @@ private void ExportGroups(IGroupsModel model, IMainPresenter presenter)
model.GroupInfo.Add(lvItem1);
}
}
//if user managed group has no members we output 1 line for exported CSV so we can see group ID etc if needed
if (groupType == "user_managed" && groupInfo["members"].Count == 0)
else
{
// update model
GroupInfoItemModel lvItem2 = new GroupInfoItemModel()
Expand All @@ -247,17 +247,6 @@ private void ExportGroups(IGroupsModel model, IMainPresenter presenter)
};
model.GroupInfo.Add(lvItem2);
}
if (groupType != "user_managed")
{
// update model
GroupInfoItemModel lvItem = new GroupInfoItemModel()
{
GroupName = groupName,
GroupId = groupId,
GroupType = groupType
};
model.GroupInfo.Add(lvItem);
}
}
}
}
Expand Down

0 comments on commit b2f2788

Please sign in to comment.