diff --git a/src/App/Pages/Vault/SharePageViewModel.cs b/src/App/Pages/Vault/SharePageViewModel.cs index ccea0ee4a..548040a5d 100644 --- a/src/App/Pages/Vault/SharePageViewModel.cs +++ b/src/App/Pages/Vault/SharePageViewModel.cs @@ -113,15 +113,9 @@ namespace Bit.App.Pages try { await _deviceActionService.ShowLoadingAsync(AppResources.Saving); - var error = await _cipherService.ShareWithServerAsync(cipherView, OrganizationId, checkedCollectionIds); + await _cipherService.ShareWithServerAsync(cipherView, OrganizationId, checkedCollectionIds); await _deviceActionService.HideLoadingAsync(); - if (error == ICipherService.ShareWithServerError.DuplicatedPasskeyInOrg) - { - _platformUtilsService.ShowToast(null, null, AppResources.ThisItemCannotBeSharedWithTheOrganizationBecauseThereIsOneAlreadyWithTheSamePasskey); - return false; - } - var movedItemToOrgText = string.Format(AppResources.MovedItemToOrg, cipherView.Name, (await _organizationService.GetAsync(OrganizationId)).Name); _platformUtilsService.ShowToast("success", null, movedItemToOrgText); diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index b2cb2b95a..513d8f2fa 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -6659,16 +6659,6 @@ namespace Bit.App.Resources { } } - /// - /// Looks up a localized string similar to This item cannot be shared with the organization because there is one already with the same passkey.. - /// - public static string ThisItemCannotBeSharedWithTheOrganizationBecauseThereIsOneAlreadyWithTheSamePasskey { - get { - return ResourceManager.GetString("ThisItemCannotBeSharedWithTheOrganizationBecauseThereIsOneAlreadyWithTheSamePassk" + - "ey", resourceCulture); - } - } - /// /// Looks up a localized string similar to This request is no longer valid. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index fd4eb3c82..ffbc3afed 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -2691,9 +2691,6 @@ Do you want to switch to this account? Vault timeout action changed to log out - - This item cannot be shared with the organization because there is one already with the same passkey. - Block auto-fill diff --git a/src/Core/Abstractions/ICipherService.cs b/src/Core/Abstractions/ICipherService.cs index 928f79686..b344bc101 100644 --- a/src/Core/Abstractions/ICipherService.cs +++ b/src/Core/Abstractions/ICipherService.cs @@ -10,12 +10,6 @@ namespace Bit.Core.Abstractions { public interface ICipherService { - public enum ShareWithServerError - { - None, - DuplicatedPasskeyInOrg - } - Task ClearAsync(string userId); Task ClearCacheAsync(); Task DeleteAsync(List ids); @@ -36,7 +30,7 @@ namespace Bit.Core.Abstractions Task SaveAttachmentRawWithServerAsync(Cipher cipher, CipherView cipherView, string filename, byte[] data); Task SaveCollectionsWithServerAsync(Cipher cipher); Task SaveWithServerAsync(Cipher cipher); - Task ShareWithServerAsync(CipherView cipher, string organizationId, HashSet collectionIds); + Task ShareWithServerAsync(CipherView cipher, string organizationId, HashSet collectionIds); Task UpdateLastUsedDateAsync(string id); Task UpsertAsync(CipherData cipher); Task UpsertAsync(List cipher); diff --git a/src/Core/Services/CipherService.cs b/src/Core/Services/CipherService.cs index 8b490d12d..e3d59d195 100644 --- a/src/Core/Services/CipherService.cs +++ b/src/Core/Services/CipherService.cs @@ -564,13 +564,8 @@ namespace Bit.Core.Services await UpsertAsync(data); } - public async Task ShareWithServerAsync(CipherView cipher, string organizationId, HashSet collectionIds) + public async Task ShareWithServerAsync(CipherView cipher, string organizationId, HashSet collectionIds) { - if (!await ValidateCanBeSharedWithOrgAsync(cipher, organizationId)) - { - return ICipherService.ShareWithServerError.DuplicatedPasskeyInOrg; - } - var attachmentTasks = new List(); if (cipher.Attachments != null) { @@ -591,21 +586,6 @@ namespace Bit.Core.Services var userId = await _stateService.GetActiveUserIdAsync(); var data = new CipherData(response, userId, collectionIds); await UpsertAsync(data); - - return ICipherService.ShareWithServerError.None; - } - - private async Task ValidateCanBeSharedWithOrgAsync(CipherView cipher, string organizationId) - { - if (!cipher.HasFido2Credential) - { - return true; - } - - var decCiphers = await GetAllDecryptedAsync(); - return !decCiphers - .Where(c => c.OrganizationId == organizationId) - .Any(c => !cipher.Login.MainFido2Credential.IsUniqueAgainst(c.Login?.MainFido2Credential)); } public async Task SaveAttachmentRawWithServerAsync(Cipher cipher, CipherView cipherView, string filename, byte[] data)