From 92505a2d4f57b8cfe4d2c28751ac804bb4e0ea30 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 14 May 2019 13:09:56 -0400 Subject: [PATCH] dont remove owners when syncing directory --- .../Implementations/OrganizationService.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index 7d04d6fedd..3af1be3145 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -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); } }