mirror of
https://github.com/bitwarden/server
synced 2026-01-07 02:53:38 +00:00
[PM-24954] [PM-24955] Remove BulkResourceCreationService Feature Flag (#6428)
* chore: remove ff implementation and superflous tests, refs PM-24954 * chore: remove UpdateForKeyRotation vNext, refs PM-24954 * chore: remove CreateAsync vNext for ImportCiphersCommand, refs PM-24954 * chore: remove UpdateCiphersAsync vNext from CipherService, refs PM-24954 * chore: formatting, refs PM-24954 * chore: fix CipherRepositoryTests by removing vNext references, refs PM-24954 * chore: remove bulk cipher copy ff key, refs PM-24954
This commit is contained in:
@@ -141,7 +141,6 @@ public static class FeatureFlagKeys
|
||||
public const string SeparateCustomRolePermissions = "pm-19917-separate-custom-role-permissions";
|
||||
public const string CreateDefaultLocation = "pm-19467-create-default-location";
|
||||
public const string PM23845_VNextApplicationCache = "pm-24957-refactor-memory-application-cache";
|
||||
public const string CipherRepositoryBulkResourceCreation = "pm-24951-cipher-repository-bulk-resource-creation-service";
|
||||
|
||||
/* Auth Team */
|
||||
public const string TwoFactorExtensionDataPersistence = "pm-9115-two-factor-extension-data-persistence";
|
||||
|
||||
@@ -25,7 +25,6 @@ public class RotateUserAccountKeysCommand : IRotateUserAccountKeysCommand
|
||||
private readonly IdentityErrorDescriber _identityErrorDescriber;
|
||||
private readonly IWebAuthnCredentialRepository _credentialRepository;
|
||||
private readonly IPasswordHasher<User> _passwordHasher;
|
||||
private readonly IFeatureService _featureService;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new <see cref="RotateUserAccountKeysCommand"/>
|
||||
@@ -61,7 +60,6 @@ public class RotateUserAccountKeysCommand : IRotateUserAccountKeysCommand
|
||||
_identityErrorDescriber = errors;
|
||||
_credentialRepository = credentialRepository;
|
||||
_passwordHasher = passwordHasher;
|
||||
_featureService = featureService;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -103,15 +101,7 @@ public class RotateUserAccountKeysCommand : IRotateUserAccountKeysCommand
|
||||
List<UpdateEncryptedDataForKeyRotation> saveEncryptedDataActions = new();
|
||||
if (model.Ciphers.Any())
|
||||
{
|
||||
var useBulkResourceCreationService = _featureService.IsEnabled(FeatureFlagKeys.CipherRepositoryBulkResourceCreation);
|
||||
if (useBulkResourceCreationService)
|
||||
{
|
||||
saveEncryptedDataActions.Add(_cipherRepository.UpdateForKeyRotation_vNext(user.Id, model.Ciphers));
|
||||
}
|
||||
else
|
||||
{
|
||||
saveEncryptedDataActions.Add(_cipherRepository.UpdateForKeyRotation(user.Id, model.Ciphers));
|
||||
}
|
||||
saveEncryptedDataActions.Add(_cipherRepository.UpdateForKeyRotation(user.Id, model.Ciphers));
|
||||
}
|
||||
|
||||
if (model.Folders.Any())
|
||||
|
||||
@@ -108,15 +108,7 @@ public class ImportCiphersCommand : IImportCiphersCommand
|
||||
}
|
||||
|
||||
// Create it all
|
||||
var useBulkResourceCreationService = _featureService.IsEnabled(FeatureFlagKeys.CipherRepositoryBulkResourceCreation);
|
||||
if (useBulkResourceCreationService)
|
||||
{
|
||||
await _cipherRepository.CreateAsync_vNext(importingUserId, ciphers, newFolders);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _cipherRepository.CreateAsync(importingUserId, ciphers, newFolders);
|
||||
}
|
||||
await _cipherRepository.CreateAsync(importingUserId, ciphers, newFolders);
|
||||
|
||||
// push
|
||||
await _pushService.PushSyncVaultAsync(importingUserId);
|
||||
@@ -191,15 +183,7 @@ public class ImportCiphersCommand : IImportCiphersCommand
|
||||
}
|
||||
|
||||
// Create it all
|
||||
var useBulkResourceCreationService = _featureService.IsEnabled(FeatureFlagKeys.CipherRepositoryBulkResourceCreation);
|
||||
if (useBulkResourceCreationService)
|
||||
{
|
||||
await _cipherRepository.CreateAsync_vNext(ciphers, newCollections, collectionCiphers, newCollectionUsers);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _cipherRepository.CreateAsync(ciphers, newCollections, collectionCiphers, newCollectionUsers);
|
||||
}
|
||||
await _cipherRepository.CreateAsync(ciphers, newCollections, collectionCiphers, newCollectionUsers);
|
||||
|
||||
// push
|
||||
await _pushService.PushSyncVaultAsync(importingUserId);
|
||||
|
||||
@@ -33,28 +33,12 @@ public interface ICipherRepository : IRepository<Cipher, Guid>
|
||||
Task DeleteByUserIdAsync(Guid userId);
|
||||
Task DeleteByOrganizationIdAsync(Guid organizationId);
|
||||
Task UpdateCiphersAsync(Guid userId, IEnumerable<Cipher> ciphers);
|
||||
/// <inheritdoc cref="UpdateCiphersAsync(Guid, IEnumerable{Cipher})"/>
|
||||
/// <remarks>
|
||||
/// This version uses the bulk resource creation service to create the temp table.
|
||||
/// </remarks>
|
||||
Task UpdateCiphersAsync_vNext(Guid userId, IEnumerable<Cipher> ciphers);
|
||||
/// <summary>
|
||||
/// Create ciphers and folders for the specified UserId. Must not be used to create organization owned items.
|
||||
/// </summary>
|
||||
Task CreateAsync(Guid userId, IEnumerable<Cipher> ciphers, IEnumerable<Folder> folders);
|
||||
/// <inheritdoc cref="CreateAsync(Guid, IEnumerable{Cipher}, IEnumerable{Folder})"/>
|
||||
/// <remarks>
|
||||
/// This version uses the bulk resource creation service to create the temp tables.
|
||||
/// </remarks>
|
||||
Task CreateAsync_vNext(Guid userId, IEnumerable<Cipher> ciphers, IEnumerable<Folder> folders);
|
||||
Task CreateAsync(IEnumerable<Cipher> ciphers, IEnumerable<Collection> collections,
|
||||
IEnumerable<CollectionCipher> collectionCiphers, IEnumerable<CollectionUser> collectionUsers);
|
||||
/// <inheritdoc cref="CreateAsync(IEnumerable{Cipher}, IEnumerable{Collection}, IEnumerable{CollectionCipher}, IEnumerable{CollectionUser})"/>
|
||||
/// <remarks>
|
||||
/// This version uses the bulk resource creation service to create the temp tables.
|
||||
/// </remarks>
|
||||
Task CreateAsync_vNext(IEnumerable<Cipher> ciphers, IEnumerable<Collection> collections,
|
||||
IEnumerable<CollectionCipher> collectionCiphers, IEnumerable<CollectionUser> collectionUsers);
|
||||
Task SoftDeleteAsync(IEnumerable<Guid> ids, Guid userId);
|
||||
Task SoftDeleteByIdsOrganizationIdAsync(IEnumerable<Guid> ids, Guid organizationId);
|
||||
Task<DateTime> UnarchiveAsync(IEnumerable<Guid> ids, Guid userId);
|
||||
@@ -92,10 +76,4 @@ public interface ICipherRepository : IRepository<Cipher, Guid>
|
||||
/// </summary>
|
||||
Task<IEnumerable<CipherOrganizationDetailsWithCollections>>
|
||||
GetManyCipherOrganizationDetailsExcludingDefaultCollectionsAsync(Guid organizationId);
|
||||
/// <inheritdoc cref="UpdateForKeyRotation(Guid, IEnumerable{Cipher})"/>
|
||||
/// <remarks>
|
||||
/// This version uses the bulk resource creation service to create the temp table.
|
||||
/// </remarks>
|
||||
UpdateEncryptedDataForKeyRotation UpdateForKeyRotation_vNext(Guid userId,
|
||||
IEnumerable<Cipher> ciphers);
|
||||
}
|
||||
|
||||
@@ -644,15 +644,7 @@ public class CipherService : ICipherService
|
||||
cipherIds.Add(cipher.Id);
|
||||
}
|
||||
|
||||
var useBulkResourceCreationService = _featureService.IsEnabled(FeatureFlagKeys.CipherRepositoryBulkResourceCreation);
|
||||
if (useBulkResourceCreationService)
|
||||
{
|
||||
await _cipherRepository.UpdateCiphersAsync_vNext(sharingUserId, cipherInfos.Select(c => c.cipher));
|
||||
}
|
||||
else
|
||||
{
|
||||
await _cipherRepository.UpdateCiphersAsync(sharingUserId, cipherInfos.Select(c => c.cipher));
|
||||
}
|
||||
await _cipherRepository.UpdateCiphersAsync(sharingUserId, cipherInfos.Select(c => c.cipher));
|
||||
await _collectionCipherRepository.UpdateCollectionsForCiphersAsync(cipherIds, sharingUserId,
|
||||
organizationId, collectionIds);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user