1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-05 23:53:33 +00:00

[PM-7407] Implemented check for organizations with unassigned items (#3150)

This commit is contained in:
Federico Maccaroni
2024-04-12 15:52:39 -03:00
committed by GitHub
parent 43a4915323
commit e7a7eed7e8
20 changed files with 166 additions and 3 deletions

View File

@@ -829,6 +829,24 @@ namespace Bit.Core.Services
await ClearCacheAsync();
}
public async Task<bool> VerifyOrganizationHasUnassignedItemsAsync()
{
var organizations = await _stateService.GetOrganizationsAsync();
if (organizations?.Any() != true)
{
return false;
}
try
{
return await _apiService.HasUnassignedCiphersAsync();
}
catch (ApiException ex) when (ex.Error?.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
return false;
}
}
// Helpers
private async Task<Tuple<SymmetricCryptoKey, EncString, SymmetricCryptoKey>> MakeAttachmentKeyAsync(string organizationId, Cipher cipher = null, CipherView cipherView = null)