internal IDictionary<GlymaPermissionLevel, IList<GlymaSecurityGroup>> FilterGroups()
{
IDictionary<GlymaPermissionLevel, IList<GlymaSecurityGroup>> result = new Dictionary<GlymaPermissionLevel, IList<GlymaSecurityGroup>>();
IList<GlymaSecurityGroup> mapManagersGroups = _groups[GlymaPermissionLevel.GlymaMapManager];
IList<GlymaSecurityGroup> mapAuthorGroups = _groups[GlymaPermissionLevel.GlymaMapAuthor];
IList<GlymaSecurityGroup> mapReaderGroups = _groups[GlymaPermissionLevel.GlymaMapReader];
IList<GlymaSecurityGroup> oldMapReaderGroups = _groups[GlymaPermissionLevel.GlymaMapReaderOld];
IList<GlymaSecurityGroup> oldMapAuthorGroups = _groups[GlymaPermissionLevel.GlymaMapAuthorOld];
//The Project Managers group doesn't get filtered
result.Add(GlymaPermissionLevel.GlymaProjectManager, _groups[GlymaPermissionLevel.GlymaProjectManager]);
//Filter the Old Map Readers
IList<GlymaSecurityGroup> filteredOldMapReaderGroups = new List<GlymaSecurityGroup>();
foreach (GlymaSecurityGroup oldMapReader in oldMapReaderGroups)
{
if (!ExistsInHigherPermissionLevel(oldMapReader, GlymaPermissionLevel.GlymaMapReader))
{
filteredOldMapReaderGroups.Add(oldMapReader);
}
}
result.Add(GlymaPermissionLevel.GlymaMapReader, filteredOldMapReaderGroups);
//Filter the Map Readers
IList<GlymaSecurityGroup> filteredMapReaderGroups = new List<GlymaSecurityGroup>();
foreach (GlymaSecurityGroup mapReader in mapReaderGroups)
{
if (!ExistsInHigherPermissionLevel(mapReader, GlymaPermissionLevel.GlymaMapReader))
{
filteredMapReaderGroups.Add(mapReader);
}
}
foreach (GlymaSecurityGroup filteredMapReader in filteredMapReaderGroups)
{
if (!result[GlymaPermissionLevel.GlymaMapReader].Contains(filteredMapReader))
{
result[GlymaPermissionLevel.GlymaMapReader].Add(filteredMapReader);
}
}
//Filter the Old Map Authors
IList<GlymaSecurityGroup> filteredOldMapAuthorGroups = new List<GlymaSecurityGroup>();
foreach (GlymaSecurityGroup oldMapAuthor in oldMapAuthorGroups)
{
if (!ExistsInHigherPermissionLevel(oldMapAuthor, GlymaPermissionLevel.GlymaMapAuthor))
{
filteredOldMapAuthorGroups.Add(oldMapAuthor);
}
}
result.Add(GlymaPermissionLevel.GlymaMapAuthor, filteredOldMapAuthorGroups);
//Filter the Map Authors
IList<GlymaSecurityGroup> filteredMapAuthorGroups = new List<GlymaSecurityGroup>();
foreach (GlymaSecurityGroup mapAuthor in mapAuthorGroups)
{
if (!ExistsInHigherPermissionLevel(mapAuthor, GlymaPermissionLevel.GlymaMapAuthor))
{
filteredMapAuthorGroups.Add(mapAuthor);
}
}
foreach (GlymaSecurityGroup filteredMapAuthor in filteredMapAuthorGroups)
{
if (!result[GlymaPermissionLevel.GlymaMapAuthor].Contains(filteredMapAuthor))
{
result[GlymaPermissionLevel.GlymaMapAuthor].Add(filteredMapAuthor);
}
}
//Filter the Map Managers
IList<GlymaSecurityGroup> filteredMapManagersGroups = new List<GlymaSecurityGroup>();
foreach (GlymaSecurityGroup mapManager in mapManagersGroups)
{
if (!ExistsInHigherPermissionLevel(mapManager, GlymaPermissionLevel.GlymaMapManager))
{
filteredMapManagersGroups.Add(mapManager);
}
}
result.Add(GlymaPermissionLevel.GlymaMapManager, filteredMapManagersGroups);
return result;
}