1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

org sync fixes

This commit is contained in:
Kyle Spearrin
2017-05-13 17:08:56 -04:00
parent a0ac7242b6
commit 56f9ea0207
3 changed files with 10 additions and 4 deletions

View File

@ -921,10 +921,12 @@ namespace Bit.Core.Services
var newGroups = groups.Where(g => !existingGroupsDict.ContainsKey(g.ExternalId));
var updateGroups = existingGroups.Where(eg => groups.Any(g => g.ExternalId == eg.ExternalId && g.Name != eg.Name));
var createdGroups = new List<Group>();
foreach(var group in newGroups)
{
group.CreationDate = group.RevisionDate = DateTime.UtcNow;
await _groupRepository.CreateAsync(group);
createdGroups.Add(group);
}
foreach(var group in updateGroups)
@ -935,12 +937,12 @@ namespace Bit.Core.Services
}
// Add the newly created groups to existing groups so that we have a complete list to reference below for users.
existingGroups.AddRange(newGroups);
existingGroups.AddRange(createdGroups);
existingGroupsDict = existingGroups.ToDictionary(g => g.ExternalId);
}
// Users
if(users?.Any() ?? false)
if(!users?.Any() ?? true)
{
return;
}