1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-28 23:04:50 -05:00

dont remove owners when syncing directory

This commit is contained in:
Kyle Spearrin 2019-05-14 13:09:56 -04:00
parent 889d770cec
commit 92505a2d4f

View File

@ -1187,8 +1187,11 @@ namespace Bit.Core.Services
foreach(var user in usersToRemove) foreach(var user in usersToRemove)
{ {
await _organizationUserRepository.DeleteAsync(new OrganizationUser { Id = user.Id }); if(user.Type != OrganizationUserType.Owner)
existingExternalUsersIdDict.Remove(user.ExternalId); {
await _organizationUserRepository.DeleteAsync(new OrganizationUser { Id = user.Id });
existingExternalUsersIdDict.Remove(user.ExternalId);
}
} }
} }
@ -1197,13 +1200,10 @@ namespace Bit.Core.Services
// Remove existing external users that are not in new user set // Remove existing external users that are not in new user set
foreach(var user in existingExternalUsers) foreach(var user in existingExternalUsers)
{ {
if(!newUsersSet.Contains(user.ExternalId) && if(user.Type != OrganizationUserType.Owner && !newUsersSet.Contains(user.ExternalId) &&
existingExternalUsersIdDict.ContainsKey(user.ExternalId)) existingExternalUsersIdDict.ContainsKey(user.ExternalId))
{ {
await _organizationUserRepository.DeleteAsync(new OrganizationUser await _organizationUserRepository.DeleteAsync(new OrganizationUser { Id = user.Id });
{
Id = user.Id
});
existingExternalUsersIdDict.Remove(user.ExternalId); existingExternalUsersIdDict.Remove(user.ExternalId);
} }
} }