1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-28 06:44: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)
{
await _organizationUserRepository.DeleteAsync(new OrganizationUser { Id = user.Id });
existingExternalUsersIdDict.Remove(user.ExternalId);
if(user.Type != OrganizationUserType.Owner)
{
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
foreach(var user in existingExternalUsers)
{
if(!newUsersSet.Contains(user.ExternalId) &&
if(user.Type != OrganizationUserType.Owner && !newUsersSet.Contains(user.ExternalId) &&
existingExternalUsersIdDict.ContainsKey(user.ExternalId))
{
await _organizationUserRepository.DeleteAsync(new OrganizationUser
{
Id = user.Id
});
await _organizationUserRepository.DeleteAsync(new OrganizationUser { Id = user.Id });
existingExternalUsersIdDict.Remove(user.ExternalId);
}
}