From 3289a8c35e8f2be63126c37b8c0586721513852a Mon Sep 17 00:00:00 2001 From: Robyn MacCallum Date: Thu, 2 Mar 2023 13:23:38 -0500 Subject: [PATCH] [SG-998] Move files to Vault folders (#2724) * Move Api files * Move Core files * Move Infrastructure files * Move Sql Files * Move Api Sync files to Vault * Move test vault files * Update Sql.sqlproj paths * Update Codeowners * Fix vault file paths in sqlproj * Update CipherDetails.sql path in sqlproj * Update Core models and entities namespaces * Update namespaces Core Services and Repositories * Missed service namespaces * Update Api namespaces * Update Infrastructure namespaces * Move infrastructure queries that were missed * Tests namespace updates * Admin and Events namespace updates * Remove unused usings * Remove extra CiphersController usings * Rename folder * Fix CipherDetails namespace * Sqlproj fixes * Move stored procs into folders by table * using order fix --- .github/CODEOWNERS | 1 + .../Controllers/OrganizationsController.cs | 1 + src/Admin/Controllers/UsersController.cs | 1 + src/Admin/Jobs/DeleteCiphersJob.cs | 2 +- src/Admin/Models/OrganizationEditModel.cs | 1 + src/Admin/Models/OrganizationViewModel.cs | 1 + src/Admin/Models/UserEditModel.cs | 1 + src/Admin/Models/UserViewModel.cs | 1 + src/Api/Controllers/AccountsController.cs | 2 + .../Controllers/EmergencyAccessController.cs | 1 + src/Api/Controllers/EventsController.cs | 1 + .../OrganizationExportController.cs | 4 +- .../Accounts/ImportCiphersRequestModel.cs | 4 +- .../Request/Accounts/UpdateKeyRequestModel.cs | 1 + .../ImportOrganizationCiphersRequestModel.cs | 4 +- .../Response/EmergencyAccessResponseModel.cs | 5 +- .../OrganizationExportResponseModel.cs | 3 +- .../Public/Controllers/EventsController.cs | 1 + .../Controllers/CiphersController.cs | 11 ++- .../Controllers/FoldersController.cs | 10 +- .../{ => Vault}/Controllers/SyncController.cs | 5 +- .../Models/CipherAttachmentModel.cs | 6 +- src/Api/{ => Vault}/Models/CipherCardModel.cs | 4 +- .../{ => Vault}/Models/CipherFieldModel.cs | 8 +- .../{ => Vault}/Models/CipherIdentityModel.cs | 4 +- .../{ => Vault}/Models/CipherLoginModel.cs | 4 +- .../Models/CipherPasswordHistoryModel.cs | 4 +- .../Models/CipherSecureNoteModel.cs | 6 +- .../Models/Request/AttachmentRequestModel.cs | 2 +- .../Request/CipherPartialRequestModel.cs | 2 +- .../Models/Request/CipherRequestModel.cs | 9 +- .../Models/Request/FolderRequestModel.cs | 4 +- .../Response/AttachmentResponseModel.cs | 6 +- .../AttachmentUploadDataResponseModel.cs | 2 +- .../Models/Response/CipherResponseModel.cs | 8 +- .../Models/Response/FolderResponseModel.cs | 6 +- .../Models/Response/SyncResponseModel.cs | 8 +- src/Core/Entities/Folder.cs | 5 +- .../Models/Data/EmergencyAccessViewData.cs | 2 +- src/Core/Repositories/IEventRepository.cs | 4 +- .../TableStorage/EventRepository.cs | 4 +- .../Services/IAttachmentStorageService.cs | 7 +- src/Core/Services/IEmergencyAccessService.cs | 1 + src/Core/Services/IEventService.cs | 1 + src/Core/Services/IPushNotificationService.cs | 1 + src/Core/Services/IUserService.cs | 1 + .../AzureQueuePushNotificationService.cs | 1 + .../Implementations/EmergencyAccessService.cs | 3 + .../Services/Implementations/EventService.cs | 1 + .../MultiServicePushNotificationService.cs | 1 + .../NotificationHubPushNotificationService.cs | 1 + ...NotificationsApiPushNotificationService.cs | 1 + .../RelayPushNotificationService.cs | 1 + .../Services/Implementations/UserService.cs | 2 + .../NoopImplementations/NoopEventService.cs | 1 + .../NoopPushNotificationService.cs | 1 + src/Core/{ => Vault}/Entities/Cipher.cs | 5 +- .../{ => Vault}/Enums/CipherRepromptType.cs | 2 +- .../{ => Vault}/Enums/CipherStateAction.cs | 2 +- src/Core/{ => Vault}/Enums/CipherType.cs | 2 +- src/Core/{ => Vault}/Enums/FieldType.cs | 2 +- src/Core/{ => Vault}/Enums/SecureNoteType.cs | 2 +- .../Models/Data/AttachmentResponseData.cs | 4 +- .../Models/Data/CipherAttachment.cs | 2 +- .../{ => Vault}/Models/Data/CipherCardData.cs | 2 +- .../{ => Vault}/Models/Data/CipherData.cs | 2 +- .../{ => Vault}/Models/Data/CipherDetails.cs | 2 +- .../Models/Data/CipherFieldData.cs | 4 +- .../Models/Data/CipherIdentityData.cs | 2 +- .../Models/Data/CipherLoginData.cs | 2 +- .../Models/Data/CipherOrganizationDetails.cs | 4 +- .../Models/Data/CipherPasswordHistoryData.cs | 2 +- .../Models/Data/CipherSecureNoteData.cs | 4 +- .../Repositories/ICipherRepository.cs | 7 +- .../Repositories/IFolderRepository.cs | 5 +- .../{ => Vault}/Services/ICipherService.cs | 6 +- .../AzureAttachmentStorageService.cs | 7 +- .../Services/Implementations/CipherService.cs | 26 +++--- .../LocalAttachmentStorageService.cs | 9 +- .../NoopAttachmentStorageService.cs | 9 +- src/Events/Controllers/CollectController.cs | 3 +- .../DapperServiceCollectionExtensions.cs | 2 + .../Repositories/EventRepository.cs | 1 + .../Repositories/CipherRepository.cs | 9 +- .../Repositories/FolderRepository.cs | 7 +- ...ityFrameworkServiceCollectionExtensions.cs | 2 + .../Models/CollectionCipher.cs | 1 + .../Models/Folder.cs | 16 ---- .../Models/Organization.cs | 1 + .../Models/User.cs | 1 + .../Repositories/DatabaseContext.cs | 1 + .../Repositories/EventRepository.cs | 2 +- .../Queries/EventReadPageByCipherIdQuery.cs | 4 +- .../Queries/UserCipherDetailsQuery.cs | 5 +- .../{ => Vault}/Models/Cipher.cs | 7 +- .../Vault/Models/Folder.cs | 17 ++++ .../Repositories/CipherRepository.cs | 38 ++++---- .../Repositories/FolderRepository.cs | 15 +-- .../Queries/CipherDetailsQuery.cs | 6 +- .../CipherOrganizationDetailsReadByIdQuery.cs | 6 +- ...izationDetailsReadByOrganizationIdQuery.cs | 5 +- .../CipherReadCanEditByIdUserIdQuery.cs | 6 +- .../Utilities/ServiceCollectionExtensions.cs | 1 + src/Sql/Sql.sqlproj | 93 ++++++++++--------- .../dbo/Functions/CipherDetails.sql | 0 .../dbo/Functions/UserCipherDetails.sql | 0 .../Cipher}/CipherDetails_Create.sql | 0 .../CipherDetails_CreateWithCollections.sql | 0 .../Cipher}/CipherDetails_ReadByIdUserId.sql | 0 .../Cipher}/CipherDetails_ReadByUserId.sql | 0 ...tails_ReadWithoutOrganizationsByUserId.sql | 0 .../Cipher}/CipherDetails_Update.sql | 0 .../CipherOrganizationDetails_ReadById.sql | 0 ...ganizationDetails_ReadByOrganizationId.sql | 0 .../Cipher}/Cipher_Create.sql | 0 .../Cipher}/Cipher_CreateWithCollections.sql | 0 .../Cipher}/Cipher_Delete.sql | 0 .../Cipher}/Cipher_DeleteAttachment.sql | 0 .../Cipher}/Cipher_DeleteById.sql | 0 .../Cipher_DeleteByIdsOrganizationId.sql | 0 .../Cipher}/Cipher_DeleteByOrganizationId.sql | 0 .../Cipher}/Cipher_DeleteByUserId.sql | 0 .../Cipher}/Cipher_DeleteDeleted.sql | 0 .../Stored Procedures/Cipher}/Cipher_Move.sql | 0 .../Cipher}/Cipher_ReadById.sql | 0 .../Cipher}/Cipher_ReadByOrganizationId.sql | 0 .../Cipher}/Cipher_ReadCanEditByIdUserId.sql | 0 .../Cipher}/Cipher_Restore.sql | 0 .../Cipher}/Cipher_SoftDelete.sql | 0 .../Cipher_SoftDeleteByIdsOrganizationId.sql | 0 .../Cipher}/Cipher_Update.sql | 0 .../Cipher}/Cipher_UpdateAttachment.sql | 0 .../Cipher}/Cipher_UpdateCollections.sql | 0 .../Cipher}/Cipher_UpdatePartial.sql | 0 .../Cipher}/Cipher_UpdateWithCollections.sql | 0 .../Folder}/Folder_Create.sql | 0 .../Folder}/Folder_DeleteById.sql | 0 .../Folder}/Folder_ReadById.sql | 0 .../Folder}/Folder_ReadByUserId.sql | 0 .../Folder}/Folder_Update.sql | 0 src/Sql/{ => Vault}/dbo/Tables/Cipher.sql | 0 src/Sql/{ => Vault}/dbo/Tables/Folder.sql | 0 src/Sql/{ => Vault}/dbo/Views/CipherView.sql | 0 src/Sql/{ => Vault}/dbo/Views/FolderView.sql | 0 .../Controllers/AccountsControllerTests.cs | 1 + .../Controllers/CiphersControllerTests.cs | 10 +- .../Controllers/SyncControllerTests.cs | 8 +- .../LocalAttachmentStorageServiceTests.cs | 6 +- .../CipherAttachmentMetaDataFixtures.cs | 2 +- .../{ => Vault}/AutoFixture/CipherFixtures.cs | 4 +- .../{ => Vault}/Models/CipherTests.cs | 2 +- .../AzureAttachmentStorageServiceTests.cs | 4 +- .../Services/CipherServiceTests.cs | 6 +- .../AutoFixture/CollectionCipherFixtures.cs | 1 + .../EntityFrameworkRepositoryFixtures.cs | 1 + .../EqualityComparers/CipherCompare.cs | 2 +- .../EqualityComparers/FolderCompare.cs | 2 +- .../{ => Vault}/AutoFixture/CipherFixtures.cs | 5 +- .../{ => Vault}/AutoFixture/FolderFixtures.cs | 3 +- .../Repositories/CipherRepositoryTests.cs | 27 +++--- .../Repositories/FolderRepositoryTests.cs | 7 +- .../Repositories/CipherRepositoryTests.cs | 5 +- 162 files changed, 375 insertions(+), 267 deletions(-) rename src/Api/{ => Vault}/Controllers/CiphersController.cs (99%) rename src/Api/{ => Vault}/Controllers/FoldersController.cs (92%) rename src/Api/{ => Vault}/Controllers/SyncController.cs (97%) rename src/Api/{ => Vault}/Models/CipherAttachmentModel.cs (79%) rename src/Api/{ => Vault}/Models/CipherCardModel.cs (93%) rename src/Api/{ => Vault}/Models/CipherFieldModel.cs (85%) rename src/Api/{ => Vault}/Models/CipherIdentityModel.cs (97%) rename src/Api/{ => Vault}/Models/CipherLoginModel.cs (96%) rename src/Api/{ => Vault}/Models/CipherPasswordHistoryModel.cs (91%) rename src/Api/{ => Vault}/Models/CipherSecureNoteModel.cs (69%) rename src/Api/{ => Vault}/Models/Request/AttachmentRequestModel.cs (82%) rename src/Api/{ => Vault}/Models/Request/CipherPartialRequestModel.cs (83%) rename src/Api/{ => Vault}/Models/Request/CipherRequestModel.cs (98%) rename src/Api/{ => Vault}/Models/Request/FolderRequestModel.cs (89%) rename src/Api/{ => Vault}/Models/Response/AttachmentResponseModel.cs (93%) rename src/Api/{ => Vault}/Models/Response/AttachmentUploadDataResponseModel.cs (91%) rename src/Api/{ => Vault}/Models/Response/CipherResponseModel.cs (97%) rename src/Api/{ => Vault}/Models/Response/FolderResponseModel.cs (82%) rename src/Api/{ => Vault}/Models/Response/SyncResponseModel.cs (93%) rename src/Core/{ => Vault}/Entities/Cipher.cs (96%) rename src/Core/{ => Vault}/Enums/CipherRepromptType.cs (68%) rename src/Core/{ => Vault}/Enums/CipherStateAction.cs (69%) rename src/Core/{ => Vault}/Enums/CipherType.cs (80%) rename src/Core/{ => Vault}/Enums/FieldType.cs (73%) rename src/Core/{ => Vault}/Enums/SecureNoteType.cs (61%) rename src/Core/{ => Vault}/Models/Data/AttachmentResponseData.cs (74%) rename src/Core/{ => Vault}/Models/Data/CipherAttachment.cs (96%) rename src/Core/{ => Vault}/Models/Data/CipherCardData.cs (88%) rename src/Core/{ => Vault}/Models/Data/CipherData.cs (87%) rename src/Core/{ => Vault}/Models/Data/CipherDetails.cs (84%) rename src/Core/{ => Vault}/Models/Data/CipherFieldData.cs (76%) rename src/Core/{ => Vault}/Models/Data/CipherIdentityData.cs (95%) rename src/Core/{ => Vault}/Models/Data/CipherLoginData.cs (95%) rename src/Core/{ => Vault}/Models/Data/CipherOrganizationDetails.cs (59%) rename src/Core/{ => Vault}/Models/Data/CipherPasswordHistoryData.cs (81%) rename src/Core/{ => Vault}/Models/Data/CipherSecureNoteData.cs (66%) rename src/Core/{ => Vault}/Repositories/ICipherRepository.cs (94%) rename src/Core/{ => Vault}/Repositories/IFolderRepository.cs (64%) rename src/Core/{ => Vault}/Services/ICipherService.cs (96%) rename src/Core/{ => Vault}/Services/Implementations/AzureAttachmentStorageService.cs (98%) rename src/Core/{ => Vault}/Services/Implementations/CipherService.cs (97%) rename src/Core/{ => Vault}/Services/Implementations/LocalAttachmentStorageService.cs (97%) rename src/Core/{ => Vault}/Services/NoopImplementations/NoopAttachmentStorageService.cs (92%) rename src/Infrastructure.Dapper/{ => Vault}/Repositories/CipherRepository.cs (99%) rename src/Infrastructure.Dapper/{ => Vault}/Repositories/FolderRepository.cs (87%) delete mode 100644 src/Infrastructure.EntityFramework/Models/Folder.cs rename src/Infrastructure.EntityFramework/{ => Vault}/Models/Cipher.cs (57%) create mode 100644 src/Infrastructure.EntityFramework/Vault/Models/Folder.cs rename src/Infrastructure.EntityFramework/{ => Vault}/Repositories/CipherRepository.cs (94%) rename src/Infrastructure.EntityFramework/{ => Vault}/Repositories/FolderRepository.cs (59%) rename src/Infrastructure.EntityFramework/{ => Vault}/Repositories/Queries/CipherDetailsQuery.cs (86%) rename src/Infrastructure.EntityFramework/{ => Vault}/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs (85%) rename src/Infrastructure.EntityFramework/{ => Vault}/Repositories/Queries/CipherOrganizationDetailsReadByOrganizationIdQuery.cs (88%) rename src/Infrastructure.EntityFramework/{ => Vault}/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs (92%) rename src/Sql/{ => Vault}/dbo/Functions/CipherDetails.sql (100%) rename src/Sql/{ => Vault}/dbo/Functions/UserCipherDetails.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/CipherDetails_Create.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/CipherDetails_CreateWithCollections.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/CipherDetails_ReadByIdUserId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/CipherDetails_ReadByUserId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/CipherDetails_ReadWithoutOrganizationsByUserId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/CipherDetails_Update.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/CipherOrganizationDetails_ReadById.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/CipherOrganizationDetails_ReadByOrganizationId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_Create.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_CreateWithCollections.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_Delete.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_DeleteAttachment.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_DeleteById.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_DeleteByIdsOrganizationId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_DeleteByOrganizationId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_DeleteByUserId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_DeleteDeleted.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_Move.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_ReadById.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_ReadByOrganizationId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_ReadCanEditByIdUserId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_Restore.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_SoftDelete.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_SoftDeleteByIdsOrganizationId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_Update.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_UpdateAttachment.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_UpdateCollections.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_UpdatePartial.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Cipher}/Cipher_UpdateWithCollections.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Folder}/Folder_Create.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Folder}/Folder_DeleteById.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Folder}/Folder_ReadById.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Folder}/Folder_ReadByUserId.sql (100%) rename src/Sql/{dbo/Stored Procedures => Vault/dbo/Stored Procedures/Folder}/Folder_Update.sql (100%) rename src/Sql/{ => Vault}/dbo/Tables/Cipher.sql (100%) rename src/Sql/{ => Vault}/dbo/Tables/Folder.sql (100%) rename src/Sql/{ => Vault}/dbo/Views/CipherView.sql (100%) rename src/Sql/{ => Vault}/dbo/Views/FolderView.sql (100%) rename test/Api.Test/{ => Vault}/Controllers/CiphersControllerTests.cs (86%) rename test/Api.Test/{ => Vault}/Controllers/SyncControllerTests.cs (98%) rename test/Core.Test/{ => Vault}/AutoFixture/CipherAttachmentMetaDataFixtures.cs (97%) rename test/Core.Test/{ => Vault}/AutoFixture/CipherFixtures.cs (95%) rename test/Core.Test/{ => Vault}/Models/CipherTests.cs (95%) rename test/Core.Test/{ => Vault}/Services/AzureAttachmentStorageServiceTests.cs (93%) rename test/Core.Test/{ => Vault}/Services/CipherServiceTests.cs (98%) rename test/Infrastructure.EFIntegration.Test/{ => Vault}/AutoFixture/CipherFixtures.cs (97%) rename test/Infrastructure.EFIntegration.Test/{ => Vault}/AutoFixture/FolderFixtures.cs (95%) rename test/Infrastructure.EFIntegration.Test/{ => Vault}/Repositories/CipherRepositoryTests.cs (86%) rename test/Infrastructure.EFIntegration.Test/{ => Vault}/Repositories/FolderRepositoryTests.cs (85%) rename test/Infrastructure.IntegrationTest/{ => Vault}/Repositories/CipherRepositoryTests.cs (95%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a4645cd12..1e001d527 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,3 +3,4 @@ # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners **/SecretsManager @bitwarden/pod-sm-dev +**/Vault @bitwarden/team-vault-dev diff --git a/src/Admin/Controllers/OrganizationsController.cs b/src/Admin/Controllers/OrganizationsController.cs index 76c00d025..0394a341a 100644 --- a/src/Admin/Controllers/OrganizationsController.cs +++ b/src/Admin/Controllers/OrganizationsController.cs @@ -8,6 +8,7 @@ using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Repositories; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Admin/Controllers/UsersController.cs b/src/Admin/Controllers/UsersController.cs index 0a4becb69..68cf70a35 100644 --- a/src/Admin/Controllers/UsersController.cs +++ b/src/Admin/Controllers/UsersController.cs @@ -4,6 +4,7 @@ using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Repositories; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Admin/Jobs/DeleteCiphersJob.cs b/src/Admin/Jobs/DeleteCiphersJob.cs index ecf13401e..ee48a26d1 100644 --- a/src/Admin/Jobs/DeleteCiphersJob.cs +++ b/src/Admin/Jobs/DeleteCiphersJob.cs @@ -1,6 +1,6 @@ using Bit.Core; using Bit.Core.Jobs; -using Bit.Core.Repositories; +using Bit.Core.Vault.Repositories; using Microsoft.Extensions.Options; using Quartz; diff --git a/src/Admin/Models/OrganizationEditModel.cs b/src/Admin/Models/OrganizationEditModel.cs index 2eeafb77a..1d18a6062 100644 --- a/src/Admin/Models/OrganizationEditModel.cs +++ b/src/Admin/Models/OrganizationEditModel.cs @@ -5,6 +5,7 @@ using Bit.Core.Models.Business; using Bit.Core.Models.Data.Organizations.OrganizationUsers; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; namespace Bit.Admin.Models; diff --git a/src/Admin/Models/OrganizationViewModel.cs b/src/Admin/Models/OrganizationViewModel.cs index 6799f34e2..520fa30e2 100644 --- a/src/Admin/Models/OrganizationViewModel.cs +++ b/src/Admin/Models/OrganizationViewModel.cs @@ -1,6 +1,7 @@ using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data.Organizations.OrganizationUsers; +using Bit.Core.Vault.Entities; namespace Bit.Admin.Models; diff --git a/src/Admin/Models/UserEditModel.cs b/src/Admin/Models/UserEditModel.cs index d7ef56f08..d438e3000 100644 --- a/src/Admin/Models/UserEditModel.cs +++ b/src/Admin/Models/UserEditModel.cs @@ -3,6 +3,7 @@ using Bit.Core.Entities; using Bit.Core.Models.Business; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; namespace Bit.Admin.Models; diff --git a/src/Admin/Models/UserViewModel.cs b/src/Admin/Models/UserViewModel.cs index f493f68f2..05160f2e0 100644 --- a/src/Admin/Models/UserViewModel.cs +++ b/src/Admin/Models/UserViewModel.cs @@ -1,4 +1,5 @@ using Bit.Core.Entities; +using Bit.Core.Vault.Entities; namespace Bit.Admin.Models; diff --git a/src/Api/Controllers/AccountsController.cs b/src/Api/Controllers/AccountsController.cs index b4c8f41ad..793413e6a 100644 --- a/src/Api/Controllers/AccountsController.cs +++ b/src/Api/Controllers/AccountsController.cs @@ -15,6 +15,8 @@ using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Repositories; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Api/Controllers/EmergencyAccessController.cs b/src/Api/Controllers/EmergencyAccessController.cs index b2eb997b4..466f80caf 100644 --- a/src/Api/Controllers/EmergencyAccessController.cs +++ b/src/Api/Controllers/EmergencyAccessController.cs @@ -1,6 +1,7 @@ using Bit.Api.Models.Request; using Bit.Api.Models.Request.Organizations; using Bit.Api.Models.Response; +using Bit.Api.Vault.Models.Response; using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Repositories; diff --git a/src/Api/Controllers/EventsController.cs b/src/Api/Controllers/EventsController.cs index 4fd1496b0..585568db6 100644 --- a/src/Api/Controllers/EventsController.cs +++ b/src/Api/Controllers/EventsController.cs @@ -4,6 +4,7 @@ using Bit.Core.Exceptions; using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Services; +using Bit.Core.Vault.Repositories; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Api/Controllers/OrganizationExportController.cs b/src/Api/Controllers/OrganizationExportController.cs index cde9a4a15..1261b938c 100644 --- a/src/Api/Controllers/OrganizationExportController.cs +++ b/src/Api/Controllers/OrganizationExportController.cs @@ -1,9 +1,11 @@ using Bit.Api.Models.Response; +using Bit.Api.Vault.Models.Response; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Services; using Bit.Core.Settings; -using Core.Models.Data; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Api/Models/Request/Accounts/ImportCiphersRequestModel.cs b/src/Api/Models/Request/Accounts/ImportCiphersRequestModel.cs index 2a675fa48..6e99d82dd 100644 --- a/src/Api/Models/Request/Accounts/ImportCiphersRequestModel.cs +++ b/src/Api/Models/Request/Accounts/ImportCiphersRequestModel.cs @@ -1,4 +1,6 @@ -namespace Bit.Api.Models.Request.Accounts; +using Bit.Api.Vault.Models.Request; + +namespace Bit.Api.Models.Request.Accounts; public class ImportCiphersRequestModel { diff --git a/src/Api/Models/Request/Accounts/UpdateKeyRequestModel.cs b/src/Api/Models/Request/Accounts/UpdateKeyRequestModel.cs index 2064c09b9..7ebc19555 100644 --- a/src/Api/Models/Request/Accounts/UpdateKeyRequestModel.cs +++ b/src/Api/Models/Request/Accounts/UpdateKeyRequestModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Bit.Api.Vault.Models.Request; namespace Bit.Api.Models.Request.Accounts; diff --git a/src/Api/Models/Request/Organizations/ImportOrganizationCiphersRequestModel.cs b/src/Api/Models/Request/Organizations/ImportOrganizationCiphersRequestModel.cs index 3aa6ef68c..34f765c92 100644 --- a/src/Api/Models/Request/Organizations/ImportOrganizationCiphersRequestModel.cs +++ b/src/Api/Models/Request/Organizations/ImportOrganizationCiphersRequestModel.cs @@ -1,4 +1,6 @@ -namespace Bit.Api.Models.Request.Organizations; +using Bit.Api.Vault.Models.Request; + +namespace Bit.Api.Models.Request.Organizations; public class ImportOrganizationCiphersRequestModel { diff --git a/src/Api/Models/Response/EmergencyAccessResponseModel.cs b/src/Api/Models/Response/EmergencyAccessResponseModel.cs index 452dabf18..6edb02502 100644 --- a/src/Api/Models/Response/EmergencyAccessResponseModel.cs +++ b/src/Api/Models/Response/EmergencyAccessResponseModel.cs @@ -1,9 +1,10 @@ -using Bit.Core.Entities; +using Bit.Api.Vault.Models.Response; +using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Api; using Bit.Core.Models.Data; using Bit.Core.Settings; -using Core.Models.Data; +using Bit.Core.Vault.Models.Data; namespace Bit.Api.Models.Response; diff --git a/src/Api/Models/Response/OrganizationExportResponseModel.cs b/src/Api/Models/Response/OrganizationExportResponseModel.cs index 53720b4b3..1bfca7e3d 100644 --- a/src/Api/Models/Response/OrganizationExportResponseModel.cs +++ b/src/Api/Models/Response/OrganizationExportResponseModel.cs @@ -1,4 +1,5 @@ -using Bit.Core.Models.Api; +using Bit.Api.Vault.Models.Response; +using Bit.Core.Models.Api; namespace Bit.Api.Models.Response; diff --git a/src/Api/Public/Controllers/EventsController.cs b/src/Api/Public/Controllers/EventsController.cs index 6e9c734c1..d2e198de1 100644 --- a/src/Api/Public/Controllers/EventsController.cs +++ b/src/Api/Public/Controllers/EventsController.cs @@ -4,6 +4,7 @@ using Bit.Api.Models.Public.Response; using Bit.Core.Context; using Bit.Core.Models.Data; using Bit.Core.Repositories; +using Bit.Core.Vault.Repositories; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Api/Controllers/CiphersController.cs b/src/Api/Vault/Controllers/CiphersController.cs similarity index 99% rename from src/Api/Controllers/CiphersController.cs rename to src/Api/Vault/Controllers/CiphersController.cs index 186cec5b5..aa8aaf587 100644 --- a/src/Api/Controllers/CiphersController.cs +++ b/src/Api/Vault/Controllers/CiphersController.cs @@ -1,24 +1,27 @@ using System.Text.Json; using Azure.Messaging.EventGrid; -using Bit.Api.Models.Request; using Bit.Api.Models.Request.Accounts; using Bit.Api.Models.Request.Organizations; using Bit.Api.Models.Response; using Bit.Api.Utilities; +using Bit.Api.Vault.Models.Request; +using Bit.Api.Vault.Models.Response; using Bit.Core; using Bit.Core.Context; using Bit.Core.Entities; using Bit.Core.Exceptions; -using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; -using Core.Models.Data; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Repositories; +using Bit.Core.Vault.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.Vault.Controllers; [Route("ciphers")] [Authorize("Application")] diff --git a/src/Api/Controllers/FoldersController.cs b/src/Api/Vault/Controllers/FoldersController.cs similarity index 92% rename from src/Api/Controllers/FoldersController.cs rename to src/Api/Vault/Controllers/FoldersController.cs index b387809ec..99a9b3e9b 100644 --- a/src/Api/Controllers/FoldersController.cs +++ b/src/Api/Vault/Controllers/FoldersController.cs @@ -1,12 +1,14 @@ -using Bit.Api.Models.Request; -using Bit.Api.Models.Response; +using Bit.Api.Models.Response; +using Bit.Api.Vault.Models.Request; +using Bit.Api.Vault.Models.Response; using Bit.Core.Exceptions; -using Bit.Core.Repositories; using Bit.Core.Services; +using Bit.Core.Vault.Repositories; +using Bit.Core.Vault.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.Vault.Controllers; [Route("folders")] [Authorize("Application")] diff --git a/src/Api/Controllers/SyncController.cs b/src/Api/Vault/Controllers/SyncController.cs similarity index 97% rename from src/Api/Controllers/SyncController.cs rename to src/Api/Vault/Controllers/SyncController.cs index 949454f9c..e16e20075 100644 --- a/src/Api/Controllers/SyncController.cs +++ b/src/Api/Vault/Controllers/SyncController.cs @@ -1,4 +1,4 @@ -using Bit.Api.Models.Response; +using Bit.Api.Vault.Models.Response; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Enums.Provider; @@ -7,10 +7,11 @@ using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; +using Bit.Core.Vault.Repositories; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -namespace Bit.Api.Controllers; +namespace Bit.Api.Vault.Controllers; [Route("sync")] [Authorize("Application")] diff --git a/src/Api/Models/CipherAttachmentModel.cs b/src/Api/Vault/Models/CipherAttachmentModel.cs similarity index 79% rename from src/Api/Models/CipherAttachmentModel.cs rename to src/Api/Vault/Models/CipherAttachmentModel.cs index c1ae19718..1eadfc8ef 100644 --- a/src/Api/Models/CipherAttachmentModel.cs +++ b/src/Api/Vault/Models/CipherAttachmentModel.cs @@ -1,7 +1,7 @@ -using Bit.Core.Models.Data; -using Bit.Core.Utilities; +using Bit.Core.Utilities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models; +namespace Bit.Api.Vault.Models; public class CipherAttachmentModel { diff --git a/src/Api/Models/CipherCardModel.cs b/src/Api/Vault/Models/CipherCardModel.cs similarity index 93% rename from src/Api/Models/CipherCardModel.cs rename to src/Api/Vault/Models/CipherCardModel.cs index 07ea4d1e6..5389de321 100644 --- a/src/Api/Models/CipherCardModel.cs +++ b/src/Api/Vault/Models/CipherCardModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Data; using Bit.Core.Utilities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models; +namespace Bit.Api.Vault.Models; public class CipherCardModel { diff --git a/src/Api/Models/CipherFieldModel.cs b/src/Api/Vault/Models/CipherFieldModel.cs similarity index 85% rename from src/Api/Models/CipherFieldModel.cs rename to src/Api/Vault/Models/CipherFieldModel.cs index 675dcfce0..d51a766f7 100644 --- a/src/Api/Models/CipherFieldModel.cs +++ b/src/Api/Vault/Models/CipherFieldModel.cs @@ -1,8 +1,8 @@ -using Bit.Core.Enums; -using Bit.Core.Models.Data; -using Bit.Core.Utilities; +using Bit.Core.Utilities; +using Bit.Core.Vault.Enums; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models; +namespace Bit.Api.Vault.Models; public class CipherFieldModel { diff --git a/src/Api/Models/CipherIdentityModel.cs b/src/Api/Vault/Models/CipherIdentityModel.cs similarity index 97% rename from src/Api/Models/CipherIdentityModel.cs rename to src/Api/Vault/Models/CipherIdentityModel.cs index 7c1fed164..ea32bab93 100644 --- a/src/Api/Models/CipherIdentityModel.cs +++ b/src/Api/Vault/Models/CipherIdentityModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Data; using Bit.Core.Utilities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models; +namespace Bit.Api.Vault.Models; public class CipherIdentityModel { diff --git a/src/Api/Models/CipherLoginModel.cs b/src/Api/Vault/Models/CipherLoginModel.cs similarity index 96% rename from src/Api/Models/CipherLoginModel.cs rename to src/Api/Vault/Models/CipherLoginModel.cs index 134ca09cb..08bdc082b 100644 --- a/src/Api/Models/CipherLoginModel.cs +++ b/src/Api/Vault/Models/CipherLoginModel.cs @@ -1,8 +1,8 @@ using Bit.Core.Enums; -using Bit.Core.Models.Data; using Bit.Core.Utilities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models; +namespace Bit.Api.Vault.Models; public class CipherLoginModel { diff --git a/src/Api/Models/CipherPasswordHistoryModel.cs b/src/Api/Vault/Models/CipherPasswordHistoryModel.cs similarity index 91% rename from src/Api/Models/CipherPasswordHistoryModel.cs rename to src/Api/Vault/Models/CipherPasswordHistoryModel.cs index 329c2cf27..6c70acb04 100644 --- a/src/Api/Models/CipherPasswordHistoryModel.cs +++ b/src/Api/Vault/Models/CipherPasswordHistoryModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Models.Data; using Bit.Core.Utilities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models; +namespace Bit.Api.Vault.Models; public class CipherPasswordHistoryModel { diff --git a/src/Api/Models/CipherSecureNoteModel.cs b/src/Api/Vault/Models/CipherSecureNoteModel.cs similarity index 69% rename from src/Api/Models/CipherSecureNoteModel.cs rename to src/Api/Vault/Models/CipherSecureNoteModel.cs index 5ab35d1e8..f5dee5091 100644 --- a/src/Api/Models/CipherSecureNoteModel.cs +++ b/src/Api/Vault/Models/CipherSecureNoteModel.cs @@ -1,7 +1,7 @@ -using Bit.Core.Enums; -using Bit.Core.Models.Data; +using Bit.Core.Vault.Enums; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models; +namespace Bit.Api.Vault.Models; public class CipherSecureNoteModel { diff --git a/src/Api/Models/Request/AttachmentRequestModel.cs b/src/Api/Vault/Models/Request/AttachmentRequestModel.cs similarity index 82% rename from src/Api/Models/Request/AttachmentRequestModel.cs rename to src/Api/Vault/Models/Request/AttachmentRequestModel.cs index cadeccdc0..e66cd56f2 100644 --- a/src/Api/Models/Request/AttachmentRequestModel.cs +++ b/src/Api/Vault/Models/Request/AttachmentRequestModel.cs @@ -1,4 +1,4 @@ -namespace Bit.Api.Models.Request; +namespace Bit.Api.Vault.Models.Request; public class AttachmentRequestModel { diff --git a/src/Api/Models/Request/CipherPartialRequestModel.cs b/src/Api/Vault/Models/Request/CipherPartialRequestModel.cs similarity index 83% rename from src/Api/Models/Request/CipherPartialRequestModel.cs rename to src/Api/Vault/Models/Request/CipherPartialRequestModel.cs index bc58eb427..6232f4ecf 100644 --- a/src/Api/Models/Request/CipherPartialRequestModel.cs +++ b/src/Api/Vault/Models/Request/CipherPartialRequestModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Bit.Api.Models.Request; +namespace Bit.Api.Vault.Models.Request; public class CipherPartialRequestModel { diff --git a/src/Api/Models/Request/CipherRequestModel.cs b/src/Api/Vault/Models/Request/CipherRequestModel.cs similarity index 98% rename from src/Api/Models/Request/CipherRequestModel.cs rename to src/Api/Vault/Models/Request/CipherRequestModel.cs index f5f3eee42..842c99800 100644 --- a/src/Api/Models/Request/CipherRequestModel.cs +++ b/src/Api/Vault/Models/Request/CipherRequestModel.cs @@ -1,14 +1,13 @@ using System.ComponentModel.DataAnnotations; using System.Text.Json; -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models.Data; using Bit.Core.Utilities; -using Core.Models.Data; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Enums; +using Bit.Core.Vault.Models.Data; using NS = Newtonsoft.Json; using NSL = Newtonsoft.Json.Linq; -namespace Bit.Api.Models.Request; +namespace Bit.Api.Vault.Models.Request; public class CipherRequestModel { diff --git a/src/Api/Models/Request/FolderRequestModel.cs b/src/Api/Vault/Models/Request/FolderRequestModel.cs similarity index 89% rename from src/Api/Models/Request/FolderRequestModel.cs rename to src/Api/Vault/Models/Request/FolderRequestModel.cs index 092b993bb..d757c3b64 100644 --- a/src/Api/Models/Request/FolderRequestModel.cs +++ b/src/Api/Vault/Models/Request/FolderRequestModel.cs @@ -1,8 +1,8 @@ using System.ComponentModel.DataAnnotations; -using Bit.Core.Entities; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; -namespace Bit.Api.Models.Request; +namespace Bit.Api.Vault.Models.Request; public class FolderRequestModel { diff --git a/src/Api/Models/Response/AttachmentResponseModel.cs b/src/Api/Vault/Models/Response/AttachmentResponseModel.cs similarity index 93% rename from src/Api/Models/Response/AttachmentResponseModel.cs rename to src/Api/Vault/Models/Response/AttachmentResponseModel.cs index 018cdd650..c7e3caabb 100644 --- a/src/Api/Models/Response/AttachmentResponseModel.cs +++ b/src/Api/Vault/Models/Response/AttachmentResponseModel.cs @@ -1,11 +1,11 @@ using System.Text.Json.Serialization; -using Bit.Core.Entities; using Bit.Core.Models.Api; -using Bit.Core.Models.Data; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models.Response; +namespace Bit.Api.Vault.Models.Response; public class AttachmentResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/AttachmentUploadDataResponseModel.cs b/src/Api/Vault/Models/Response/AttachmentUploadDataResponseModel.cs similarity index 91% rename from src/Api/Models/Response/AttachmentUploadDataResponseModel.cs rename to src/Api/Vault/Models/Response/AttachmentUploadDataResponseModel.cs index 1c9a5d2a7..9eff41776 100644 --- a/src/Api/Models/Response/AttachmentUploadDataResponseModel.cs +++ b/src/Api/Vault/Models/Response/AttachmentUploadDataResponseModel.cs @@ -1,7 +1,7 @@ using Bit.Core.Enums; using Bit.Core.Models.Api; -namespace Bit.Api.Models.Response; +namespace Bit.Api.Vault.Models.Response; public class AttachmentUploadDataResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/CipherResponseModel.cs b/src/Api/Vault/Models/Response/CipherResponseModel.cs similarity index 97% rename from src/Api/Models/Response/CipherResponseModel.cs rename to src/Api/Vault/Models/Response/CipherResponseModel.cs index b0b244ff8..e2526dea9 100644 --- a/src/Api/Models/Response/CipherResponseModel.cs +++ b/src/Api/Vault/Models/Response/CipherResponseModel.cs @@ -1,12 +1,12 @@ using System.Text.Json; using Bit.Core.Entities; -using Bit.Core.Enums; using Bit.Core.Models.Api; -using Bit.Core.Models.Data; using Bit.Core.Settings; -using Core.Models.Data; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Enums; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models.Response; +namespace Bit.Api.Vault.Models.Response; public class CipherMiniResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/FolderResponseModel.cs b/src/Api/Vault/Models/Response/FolderResponseModel.cs similarity index 82% rename from src/Api/Models/Response/FolderResponseModel.cs rename to src/Api/Vault/Models/Response/FolderResponseModel.cs index 03971b4e3..c1b29dfb9 100644 --- a/src/Api/Models/Response/FolderResponseModel.cs +++ b/src/Api/Vault/Models/Response/FolderResponseModel.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Api; +using Bit.Core.Models.Api; +using Bit.Core.Vault.Entities; -namespace Bit.Api.Models.Response; +namespace Bit.Api.Vault.Models.Response; public class FolderResponseModel : ResponseModel { diff --git a/src/Api/Models/Response/SyncResponseModel.cs b/src/Api/Vault/Models/Response/SyncResponseModel.cs similarity index 93% rename from src/Api/Models/Response/SyncResponseModel.cs rename to src/Api/Vault/Models/Response/SyncResponseModel.cs index 6d028b12f..5aeb0e46a 100644 --- a/src/Api/Models/Response/SyncResponseModel.cs +++ b/src/Api/Vault/Models/Response/SyncResponseModel.cs @@ -1,11 +1,13 @@ -using Bit.Core.Entities; +using Bit.Api.Models.Response; +using Bit.Core.Entities; using Bit.Core.Models.Api; using Bit.Core.Models.Data; using Bit.Core.Models.Data.Organizations.OrganizationUsers; using Bit.Core.Settings; -using Core.Models.Data; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Api.Models.Response; +namespace Bit.Api.Vault.Models.Response; public class SyncResponseModel : ResponseModel { diff --git a/src/Core/Entities/Folder.cs b/src/Core/Entities/Folder.cs index fd6d4dafa..37a1d3c69 100644 --- a/src/Core/Entities/Folder.cs +++ b/src/Core/Entities/Folder.cs @@ -1,6 +1,7 @@ -using Bit.Core.Utilities; +using Bit.Core.Entities; +using Bit.Core.Utilities; -namespace Bit.Core.Entities; +namespace Bit.Core.Vault.Entities; public class Folder : ITableObject { diff --git a/src/Core/Models/Data/EmergencyAccessViewData.cs b/src/Core/Models/Data/EmergencyAccessViewData.cs index ef9ffb0a2..9e87e1453 100644 --- a/src/Core/Models/Data/EmergencyAccessViewData.cs +++ b/src/Core/Models/Data/EmergencyAccessViewData.cs @@ -1,5 +1,5 @@ using Bit.Core.Entities; -using Core.Models.Data; +using Bit.Core.Vault.Models.Data; namespace Bit.Core.Models.Data; diff --git a/src/Core/Repositories/IEventRepository.cs b/src/Core/Repositories/IEventRepository.cs index bac3cb534..493c8c787 100644 --- a/src/Core/Repositories/IEventRepository.cs +++ b/src/Core/Repositories/IEventRepository.cs @@ -1,5 +1,5 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Data; +using Bit.Core.Models.Data; +using Bit.Core.Vault.Entities; namespace Bit.Core.Repositories; diff --git a/src/Core/Repositories/TableStorage/EventRepository.cs b/src/Core/Repositories/TableStorage/EventRepository.cs index 514b61099..3822ce35d 100644 --- a/src/Core/Repositories/TableStorage/EventRepository.cs +++ b/src/Core/Repositories/TableStorage/EventRepository.cs @@ -1,7 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Data; +using Bit.Core.Models.Data; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; using Microsoft.Azure.Cosmos.Table; namespace Bit.Core.Repositories.TableStorage; diff --git a/src/Core/Services/IAttachmentStorageService.cs b/src/Core/Services/IAttachmentStorageService.cs index 964b711f0..7c19ce321 100644 --- a/src/Core/Services/IAttachmentStorageService.cs +++ b/src/Core/Services/IAttachmentStorageService.cs @@ -1,6 +1,7 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models.Data; +using Bit.Core.Enums; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; + namespace Bit.Core.Services; diff --git a/src/Core/Services/IEmergencyAccessService.cs b/src/Core/Services/IEmergencyAccessService.cs index 96edb752c..4b6d68d7c 100644 --- a/src/Core/Services/IEmergencyAccessService.cs +++ b/src/Core/Services/IEmergencyAccessService.cs @@ -1,6 +1,7 @@ using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models.Data; +using Bit.Core.Vault.Models.Data; namespace Bit.Core.Services; diff --git a/src/Core/Services/IEventService.cs b/src/Core/Services/IEventService.cs index c22757f9c..e76d08630 100644 --- a/src/Core/Services/IEventService.cs +++ b/src/Core/Services/IEventService.cs @@ -2,6 +2,7 @@ using Bit.Core.Entities.Provider; using Bit.Core.Enums; using Bit.Core.SecretsManager.Entities; +using Bit.Core.Vault.Entities; namespace Bit.Core.Services; diff --git a/src/Core/Services/IPushNotificationService.cs b/src/Core/Services/IPushNotificationService.cs index eec8a2628..46475bd79 100644 --- a/src/Core/Services/IPushNotificationService.cs +++ b/src/Core/Services/IPushNotificationService.cs @@ -1,5 +1,6 @@ using Bit.Core.Entities; using Bit.Core.Enums; +using Bit.Core.Vault.Entities; namespace Bit.Core.Services; diff --git a/src/Core/Services/IUserService.cs b/src/Core/Services/IUserService.cs index fd66feed3..849be5c88 100644 --- a/src/Core/Services/IUserService.cs +++ b/src/Core/Services/IUserService.cs @@ -3,6 +3,7 @@ using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Models.Business; +using Bit.Core.Vault.Entities; using Fido2NetLib; using Microsoft.AspNetCore.Identity; diff --git a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs index 6849bfbbf..f7b890576 100644 --- a/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs +++ b/src/Core/Services/Implementations/AzureQueuePushNotificationService.cs @@ -6,6 +6,7 @@ using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; using Microsoft.AspNetCore.Http; namespace Bit.Core.Services; diff --git a/src/Core/Services/Implementations/EmergencyAccessService.cs b/src/Core/Services/Implementations/EmergencyAccessService.cs index f5ddf7adf..feda05d03 100644 --- a/src/Core/Services/Implementations/EmergencyAccessService.cs +++ b/src/Core/Services/Implementations/EmergencyAccessService.cs @@ -7,6 +7,9 @@ using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Tokens; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Repositories; +using Bit.Core.Vault.Services; using Microsoft.AspNetCore.Identity; namespace Bit.Core.Services; diff --git a/src/Core/Services/Implementations/EventService.cs b/src/Core/Services/Implementations/EventService.cs index cf74767be..e599c1d30 100644 --- a/src/Core/Services/Implementations/EventService.cs +++ b/src/Core/Services/Implementations/EventService.cs @@ -7,6 +7,7 @@ using Bit.Core.Models.Data.Organizations; using Bit.Core.Repositories; using Bit.Core.SecretsManager.Entities; using Bit.Core.Settings; +using Bit.Core.Vault.Entities; namespace Bit.Core.Services; diff --git a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs index 1a64829cc..53aa2601b 100644 --- a/src/Core/Services/Implementations/MultiServicePushNotificationService.cs +++ b/src/Core/Services/Implementations/MultiServicePushNotificationService.cs @@ -3,6 +3,7 @@ using Bit.Core.Enums; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; diff --git a/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs b/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs index e52c99878..ed61d11c4 100644 --- a/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs +++ b/src/Core/Services/Implementations/NotificationHubPushNotificationService.cs @@ -7,6 +7,7 @@ using Bit.Core.Models; using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Settings; +using Bit.Core.Vault.Entities; using Microsoft.AspNetCore.Http; using Microsoft.Azure.NotificationHubs; using Microsoft.Extensions.Logging; diff --git a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs index 124274496..7c8a3eb30 100644 --- a/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs +++ b/src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs @@ -3,6 +3,7 @@ using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Models; using Bit.Core.Settings; +using Bit.Core.Vault.Entities; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; diff --git a/src/Core/Services/Implementations/RelayPushNotificationService.cs b/src/Core/Services/Implementations/RelayPushNotificationService.cs index e44707192..18a158e80 100644 --- a/src/Core/Services/Implementations/RelayPushNotificationService.cs +++ b/src/Core/Services/Implementations/RelayPushNotificationService.cs @@ -6,6 +6,7 @@ using Bit.Core.Models; using Bit.Core.Models.Api; using Bit.Core.Repositories; using Bit.Core.Settings; +using Bit.Core.Vault.Entities; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; diff --git a/src/Core/Services/Implementations/UserService.cs b/src/Core/Services/Implementations/UserService.cs index 659ace42b..ffc32ecaa 100644 --- a/src/Core/Services/Implementations/UserService.cs +++ b/src/Core/Services/Implementations/UserService.cs @@ -9,6 +9,8 @@ using Bit.Core.Models.Business; using Bit.Core.Repositories; using Bit.Core.Settings; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Repositories; using Fido2NetLib; using Fido2NetLib.Objects; using Microsoft.AspNetCore.DataProtection; diff --git a/src/Core/Services/NoopImplementations/NoopEventService.cs b/src/Core/Services/NoopImplementations/NoopEventService.cs index 0f23933b7..c773c6a26 100644 --- a/src/Core/Services/NoopImplementations/NoopEventService.cs +++ b/src/Core/Services/NoopImplementations/NoopEventService.cs @@ -2,6 +2,7 @@ using Bit.Core.Entities.Provider; using Bit.Core.Enums; using Bit.Core.SecretsManager.Entities; +using Bit.Core.Vault.Entities; namespace Bit.Core.Services; diff --git a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs index efc445f69..4f9056835 100644 --- a/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs +++ b/src/Core/Services/NoopImplementations/NoopPushNotificationService.cs @@ -1,5 +1,6 @@ using Bit.Core.Entities; using Bit.Core.Enums; +using Bit.Core.Vault.Entities; namespace Bit.Core.Services; diff --git a/src/Core/Entities/Cipher.cs b/src/Core/Vault/Entities/Cipher.cs similarity index 96% rename from src/Core/Entities/Cipher.cs rename to src/Core/Vault/Entities/Cipher.cs index 186a7c5b8..4ef4a1edb 100644 --- a/src/Core/Entities/Cipher.cs +++ b/src/Core/Vault/Entities/Cipher.cs @@ -1,8 +1,9 @@ using System.Text.Json; -using Bit.Core.Models.Data; +using Bit.Core.Entities; using Bit.Core.Utilities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Core.Entities; +namespace Bit.Core.Vault.Entities; public class Cipher : ITableObject, ICloneable { diff --git a/src/Core/Enums/CipherRepromptType.cs b/src/Core/Vault/Enums/CipherRepromptType.cs similarity index 68% rename from src/Core/Enums/CipherRepromptType.cs rename to src/Core/Vault/Enums/CipherRepromptType.cs index 3c64c1945..0e6ea3fce 100644 --- a/src/Core/Enums/CipherRepromptType.cs +++ b/src/Core/Vault/Enums/CipherRepromptType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Vault.Enums; public enum CipherRepromptType : byte { diff --git a/src/Core/Enums/CipherStateAction.cs b/src/Core/Vault/Enums/CipherStateAction.cs similarity index 69% rename from src/Core/Enums/CipherStateAction.cs rename to src/Core/Vault/Enums/CipherStateAction.cs index 926c8b06c..adbc78c06 100644 --- a/src/Core/Enums/CipherStateAction.cs +++ b/src/Core/Vault/Enums/CipherStateAction.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Vault.Enums; public enum CipherStateAction { diff --git a/src/Core/Enums/CipherType.cs b/src/Core/Vault/Enums/CipherType.cs similarity index 80% rename from src/Core/Enums/CipherType.cs rename to src/Core/Vault/Enums/CipherType.cs index d9f37bcbc..c5a61043d 100644 --- a/src/Core/Enums/CipherType.cs +++ b/src/Core/Vault/Enums/CipherType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Vault.Enums; public enum CipherType : byte { diff --git a/src/Core/Enums/FieldType.cs b/src/Core/Vault/Enums/FieldType.cs similarity index 73% rename from src/Core/Enums/FieldType.cs rename to src/Core/Vault/Enums/FieldType.cs index 4642b63a8..0c9c140b3 100644 --- a/src/Core/Enums/FieldType.cs +++ b/src/Core/Vault/Enums/FieldType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Vault.Enums; public enum FieldType : byte { diff --git a/src/Core/Enums/SecureNoteType.cs b/src/Core/Vault/Enums/SecureNoteType.cs similarity index 61% rename from src/Core/Enums/SecureNoteType.cs rename to src/Core/Vault/Enums/SecureNoteType.cs index cdd565e7c..60de84905 100644 --- a/src/Core/Enums/SecureNoteType.cs +++ b/src/Core/Vault/Enums/SecureNoteType.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Enums; +namespace Bit.Core.Vault.Enums; public enum SecureNoteType : byte { diff --git a/src/Core/Models/Data/AttachmentResponseData.cs b/src/Core/Vault/Models/Data/AttachmentResponseData.cs similarity index 74% rename from src/Core/Models/Data/AttachmentResponseData.cs rename to src/Core/Vault/Models/Data/AttachmentResponseData.cs index f45125c3d..ecb140491 100644 --- a/src/Core/Models/Data/AttachmentResponseData.cs +++ b/src/Core/Vault/Models/Data/AttachmentResponseData.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.Vault.Entities; -namespace Bit.Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class AttachmentResponseData { diff --git a/src/Core/Models/Data/CipherAttachment.cs b/src/Core/Vault/Models/Data/CipherAttachment.cs similarity index 96% rename from src/Core/Models/Data/CipherAttachment.cs rename to src/Core/Vault/Models/Data/CipherAttachment.cs index 62b46335a..78817aeb7 100644 --- a/src/Core/Models/Data/CipherAttachment.cs +++ b/src/Core/Vault/Models/Data/CipherAttachment.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Bit.Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class CipherAttachment { diff --git a/src/Core/Models/Data/CipherCardData.cs b/src/Core/Vault/Models/Data/CipherCardData.cs similarity index 88% rename from src/Core/Models/Data/CipherCardData.cs rename to src/Core/Vault/Models/Data/CipherCardData.cs index fdfc604da..72a60176f 100644 --- a/src/Core/Models/Data/CipherCardData.cs +++ b/src/Core/Vault/Models/Data/CipherCardData.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class CipherCardData : CipherData { diff --git a/src/Core/Models/Data/CipherData.cs b/src/Core/Vault/Models/Data/CipherData.cs similarity index 87% rename from src/Core/Models/Data/CipherData.cs rename to src/Core/Vault/Models/Data/CipherData.cs index 9881ed6ba..459ee0d73 100644 --- a/src/Core/Models/Data/CipherData.cs +++ b/src/Core/Vault/Models/Data/CipherData.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public abstract class CipherData { diff --git a/src/Core/Models/Data/CipherDetails.cs b/src/Core/Vault/Models/Data/CipherDetails.cs similarity index 84% rename from src/Core/Models/Data/CipherDetails.cs rename to src/Core/Vault/Models/Data/CipherDetails.cs index 21a636bf7..dfb316949 100644 --- a/src/Core/Models/Data/CipherDetails.cs +++ b/src/Core/Vault/Models/Data/CipherDetails.cs @@ -1,4 +1,4 @@ -namespace Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class CipherDetails : CipherOrganizationDetails { diff --git a/src/Core/Models/Data/CipherFieldData.cs b/src/Core/Vault/Models/Data/CipherFieldData.cs similarity index 76% rename from src/Core/Models/Data/CipherFieldData.cs rename to src/Core/Vault/Models/Data/CipherFieldData.cs index 748a478cf..b7969b11a 100644 --- a/src/Core/Models/Data/CipherFieldData.cs +++ b/src/Core/Vault/Models/Data/CipherFieldData.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; +using Bit.Core.Vault.Enums; -namespace Bit.Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class CipherFieldData { diff --git a/src/Core/Models/Data/CipherIdentityData.cs b/src/Core/Vault/Models/Data/CipherIdentityData.cs similarity index 95% rename from src/Core/Models/Data/CipherIdentityData.cs rename to src/Core/Vault/Models/Data/CipherIdentityData.cs index 19773424a..9a8b2811a 100644 --- a/src/Core/Models/Data/CipherIdentityData.cs +++ b/src/Core/Vault/Models/Data/CipherIdentityData.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class CipherIdentityData : CipherData { diff --git a/src/Core/Models/Data/CipherLoginData.cs b/src/Core/Vault/Models/Data/CipherLoginData.cs similarity index 95% rename from src/Core/Models/Data/CipherLoginData.cs rename to src/Core/Vault/Models/Data/CipherLoginData.cs index d266d7786..223f85ef2 100644 --- a/src/Core/Models/Data/CipherLoginData.cs +++ b/src/Core/Vault/Models/Data/CipherLoginData.cs @@ -1,6 +1,6 @@ using Bit.Core.Enums; -namespace Bit.Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class CipherLoginData : CipherData { diff --git a/src/Core/Models/Data/CipherOrganizationDetails.cs b/src/Core/Vault/Models/Data/CipherOrganizationDetails.cs similarity index 59% rename from src/Core/Models/Data/CipherOrganizationDetails.cs rename to src/Core/Vault/Models/Data/CipherOrganizationDetails.cs index d2717b30f..d1571b744 100644 --- a/src/Core/Models/Data/CipherOrganizationDetails.cs +++ b/src/Core/Vault/Models/Data/CipherOrganizationDetails.cs @@ -1,6 +1,6 @@ -using Bit.Core.Entities; +using Bit.Core.Vault.Entities; -namespace Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class CipherOrganizationDetails : Cipher { diff --git a/src/Core/Models/Data/CipherPasswordHistoryData.cs b/src/Core/Vault/Models/Data/CipherPasswordHistoryData.cs similarity index 81% rename from src/Core/Models/Data/CipherPasswordHistoryData.cs rename to src/Core/Vault/Models/Data/CipherPasswordHistoryData.cs index 3ea5edab4..3cac41f41 100644 --- a/src/Core/Models/Data/CipherPasswordHistoryData.cs +++ b/src/Core/Vault/Models/Data/CipherPasswordHistoryData.cs @@ -1,4 +1,4 @@ -namespace Bit.Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class CipherPasswordHistoryData { diff --git a/src/Core/Models/Data/CipherSecureNoteData.cs b/src/Core/Vault/Models/Data/CipherSecureNoteData.cs similarity index 66% rename from src/Core/Models/Data/CipherSecureNoteData.cs rename to src/Core/Vault/Models/Data/CipherSecureNoteData.cs index 88b7384cd..db70a940d 100644 --- a/src/Core/Models/Data/CipherSecureNoteData.cs +++ b/src/Core/Vault/Models/Data/CipherSecureNoteData.cs @@ -1,6 +1,6 @@ -using Bit.Core.Enums; +using Bit.Core.Vault.Enums; -namespace Bit.Core.Models.Data; +namespace Bit.Core.Vault.Models.Data; public class CipherSecureNoteData : CipherData { diff --git a/src/Core/Repositories/ICipherRepository.cs b/src/Core/Vault/Repositories/ICipherRepository.cs similarity index 94% rename from src/Core/Repositories/ICipherRepository.cs rename to src/Core/Vault/Repositories/ICipherRepository.cs index 56f761935..4ffd2545d 100644 --- a/src/Core/Repositories/ICipherRepository.cs +++ b/src/Core/Vault/Repositories/ICipherRepository.cs @@ -1,8 +1,9 @@ using Bit.Core.Entities; -using Bit.Core.Models.Data; -using Core.Models.Data; +using Bit.Core.Repositories; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Core.Repositories; +namespace Bit.Core.Vault.Repositories; public interface ICipherRepository : IRepository { diff --git a/src/Core/Repositories/IFolderRepository.cs b/src/Core/Vault/Repositories/IFolderRepository.cs similarity index 64% rename from src/Core/Repositories/IFolderRepository.cs rename to src/Core/Vault/Repositories/IFolderRepository.cs index b93ca097b..3b7c2f77f 100644 --- a/src/Core/Repositories/IFolderRepository.cs +++ b/src/Core/Vault/Repositories/IFolderRepository.cs @@ -1,6 +1,7 @@ -using Bit.Core.Entities; +using Bit.Core.Repositories; +using Bit.Core.Vault.Entities; -namespace Bit.Core.Repositories; +namespace Bit.Core.Vault.Repositories; public interface IFolderRepository : IRepository { diff --git a/src/Core/Services/ICipherService.cs b/src/Core/Vault/Services/ICipherService.cs similarity index 96% rename from src/Core/Services/ICipherService.cs rename to src/Core/Vault/Services/ICipherService.cs index ad93990c2..165be9a59 100644 --- a/src/Core/Services/ICipherService.cs +++ b/src/Core/Vault/Services/ICipherService.cs @@ -1,8 +1,8 @@ using Bit.Core.Entities; -using Bit.Core.Models.Data; -using Core.Models.Data; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Core.Services; +namespace Bit.Core.Vault.Services; public interface ICipherService { diff --git a/src/Core/Services/Implementations/AzureAttachmentStorageService.cs b/src/Core/Vault/Services/Implementations/AzureAttachmentStorageService.cs similarity index 98% rename from src/Core/Services/Implementations/AzureAttachmentStorageService.cs rename to src/Core/Vault/Services/Implementations/AzureAttachmentStorageService.cs index edc35e03a..20e481666 100644 --- a/src/Core/Services/Implementations/AzureAttachmentStorageService.cs +++ b/src/Core/Vault/Services/Implementations/AzureAttachmentStorageService.cs @@ -1,13 +1,14 @@ using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; using Azure.Storage.Sas; -using Bit.Core.Entities; using Bit.Core.Enums; -using Bit.Core.Models.Data; +using Bit.Core.Services; using Bit.Core.Settings; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; using Microsoft.Extensions.Logging; -namespace Bit.Core.Services; +namespace Bit.Core.Vault.Services; public class AzureAttachmentStorageService : IAttachmentStorageService { diff --git a/src/Core/Services/Implementations/CipherService.cs b/src/Core/Vault/Services/Implementations/CipherService.cs similarity index 97% rename from src/Core/Services/Implementations/CipherService.cs rename to src/Core/Vault/Services/Implementations/CipherService.cs index 21bb4a857..ed1b8e85b 100644 --- a/src/Core/Services/Implementations/CipherService.cs +++ b/src/Core/Vault/Services/Implementations/CipherService.cs @@ -4,13 +4,15 @@ using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Business; -using Bit.Core.Models.Data; using Bit.Core.Repositories; +using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Utilities; -using Core.Models.Data; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Repositories; -namespace Bit.Core.Services; +namespace Bit.Core.Vault.Services; public class CipherService : ICipherService { @@ -90,7 +92,7 @@ public class CipherService : ICipherService { await _cipherRepository.CreateAsync(cipher); } - await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Created); + await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Created); // push await _pushService.PushSyncCipherCreateAsync(cipher, null); @@ -100,7 +102,7 @@ public class CipherService : ICipherService ValidateCipherLastKnownRevisionDateAsync(cipher, lastKnownRevisionDate); cipher.RevisionDate = DateTime.UtcNow; await _cipherRepository.ReplaceAsync(cipher); - await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Updated); + await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Updated); // push await _pushService.PushSyncCipherUpdateAsync(cipher, collectionIds); @@ -138,7 +140,7 @@ public class CipherService : ICipherService } await _cipherRepository.CreateAsync(cipher); } - await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Created); + await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Created); if (cipher.OrganizationId.HasValue) { @@ -154,7 +156,7 @@ public class CipherService : ICipherService ValidateCipherLastKnownRevisionDateAsync(cipher, lastKnownRevisionDate); cipher.RevisionDate = DateTime.UtcNow; await _cipherRepository.ReplaceAsync(cipher); - await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Updated); + await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Updated); // push await _pushService.PushSyncCipherUpdateAsync(cipher, collectionIds); @@ -236,7 +238,7 @@ public class CipherService : ICipherService }; await _cipherRepository.UpdateAttachmentAsync(attachment); - await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_AttachmentCreated); + await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_AttachmentCreated); cipher.AddAttachment(attachmentId, data); if (!await ValidateCipherAttachmentFile(cipher, data)) @@ -436,7 +438,7 @@ public class CipherService : ICipherService throw new NotFoundException(); } await _cipherRepository.DeleteByOrganizationIdAsync(organizationId); - await _eventService.LogOrganizationEventAsync(org, Enums.EventType.Organization_PurgedVault); + await _eventService.LogOrganizationEventAsync(org, Bit.Core.Enums.EventType.Organization_PurgedVault); } public async Task MoveManyAsync(IEnumerable cipherIds, Guid? destinationFolderId, Guid movingUserId) @@ -505,7 +507,7 @@ public class CipherService : ICipherService } updatedCipher = true; - await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_Shared); + await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_Shared); if (hasOldAttachments) { @@ -614,7 +616,7 @@ public class CipherService : ICipherService await _collectionCipherRepository.UpdateCollectionsAsync(cipher.Id, savingUserId, collectionIds); } - await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_UpdatedCollections); + await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_UpdatedCollections); // push await _pushService.PushSyncCipherUpdateAsync(cipher, collectionIds); @@ -913,7 +915,7 @@ public class CipherService : ICipherService await _cipherRepository.DeleteAttachmentAsync(cipher.Id, attachmentData.AttachmentId); cipher.DeleteAttachment(attachmentData.AttachmentId); await _attachmentStorageService.DeleteAttachmentAsync(cipher.Id, attachmentData); - await _eventService.LogCipherEventAsync(cipher, Enums.EventType.Cipher_AttachmentDeleted); + await _eventService.LogCipherEventAsync(cipher, Bit.Core.Enums.EventType.Cipher_AttachmentDeleted); // push await _pushService.PushSyncCipherUpdateAsync(cipher, null); diff --git a/src/Core/Services/Implementations/LocalAttachmentStorageService.cs b/src/Core/Vault/Services/Implementations/LocalAttachmentStorageService.cs similarity index 97% rename from src/Core/Services/Implementations/LocalAttachmentStorageService.cs rename to src/Core/Vault/Services/Implementations/LocalAttachmentStorageService.cs index 4949ff312..ac3c4a796 100644 --- a/src/Core/Services/Implementations/LocalAttachmentStorageService.cs +++ b/src/Core/Vault/Services/Implementations/LocalAttachmentStorageService.cs @@ -1,9 +1,10 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models.Data; +using Bit.Core.Enums; +using Bit.Core.Services; using Bit.Core.Settings; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Core.Services; +namespace Bit.Core.Vault.Services; public class LocalAttachmentStorageService : IAttachmentStorageService { diff --git a/src/Core/Services/NoopImplementations/NoopAttachmentStorageService.cs b/src/Core/Vault/Services/NoopImplementations/NoopAttachmentStorageService.cs similarity index 92% rename from src/Core/Services/NoopImplementations/NoopAttachmentStorageService.cs rename to src/Core/Vault/Services/NoopImplementations/NoopAttachmentStorageService.cs index 24f669c36..6e6379d5b 100644 --- a/src/Core/Services/NoopImplementations/NoopAttachmentStorageService.cs +++ b/src/Core/Vault/Services/NoopImplementations/NoopAttachmentStorageService.cs @@ -1,8 +1,9 @@ -using Bit.Core.Entities; -using Bit.Core.Enums; -using Bit.Core.Models.Data; +using Bit.Core.Enums; +using Bit.Core.Services; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; -namespace Bit.Core.Services; +namespace Bit.Core.Vault.Services; public class NoopAttachmentStorageService : IAttachmentStorageService { diff --git a/src/Events/Controllers/CollectController.cs b/src/Events/Controllers/CollectController.cs index 9a8d81bdf..a2bef7a7d 100644 --- a/src/Events/Controllers/CollectController.cs +++ b/src/Events/Controllers/CollectController.cs @@ -1,8 +1,9 @@ using Bit.Core.Context; -using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Repositories; using Bit.Core.Services; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Repositories; using Bit.Events.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs index 44e67f261..5a1b552e4 100644 --- a/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs +++ b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs @@ -1,7 +1,9 @@ using Bit.Core.Repositories; using Bit.Core.SecretsManager.Repositories; +using Bit.Core.Vault.Repositories; using Bit.Infrastructure.Dapper.Repositories; using Bit.Infrastructure.Dapper.SecretsManager.Repositories; +using Bit.Infrastructure.Dapper.Vault.Repositories; using Microsoft.Extensions.DependencyInjection; namespace Bit.Infrastructure.Dapper; diff --git a/src/Infrastructure.Dapper/Repositories/EventRepository.cs b/src/Infrastructure.Dapper/Repositories/EventRepository.cs index 97a2b7d9d..1c5b805c4 100644 --- a/src/Infrastructure.Dapper/Repositories/EventRepository.cs +++ b/src/Infrastructure.Dapper/Repositories/EventRepository.cs @@ -3,6 +3,7 @@ using Bit.Core.Entities; using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Settings; +using Bit.Core.Vault.Entities; using Dapper; using Microsoft.Data.SqlClient; diff --git a/src/Infrastructure.Dapper/Repositories/CipherRepository.cs b/src/Infrastructure.Dapper/Vault/Repositories/CipherRepository.cs similarity index 99% rename from src/Infrastructure.Dapper/Repositories/CipherRepository.cs rename to src/Infrastructure.Dapper/Vault/Repositories/CipherRepository.cs index 8045aaf66..aa2d12445 100644 --- a/src/Infrastructure.Dapper/Repositories/CipherRepository.cs +++ b/src/Infrastructure.Dapper/Vault/Repositories/CipherRepository.cs @@ -1,14 +1,15 @@ using System.Data; using System.Text.Json; using Bit.Core.Entities; -using Bit.Core.Models.Data; -using Bit.Core.Repositories; using Bit.Core.Settings; -using Core.Models.Data; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Repositories; +using Bit.Infrastructure.Dapper.Repositories; using Dapper; using Microsoft.Data.SqlClient; -namespace Bit.Infrastructure.Dapper.Repositories; +namespace Bit.Infrastructure.Dapper.Vault.Repositories; public class CipherRepository : Repository, ICipherRepository { diff --git a/src/Infrastructure.Dapper/Repositories/FolderRepository.cs b/src/Infrastructure.Dapper/Vault/Repositories/FolderRepository.cs similarity index 87% rename from src/Infrastructure.Dapper/Repositories/FolderRepository.cs rename to src/Infrastructure.Dapper/Vault/Repositories/FolderRepository.cs index 6055e2872..1703b969a 100644 --- a/src/Infrastructure.Dapper/Repositories/FolderRepository.cs +++ b/src/Infrastructure.Dapper/Vault/Repositories/FolderRepository.cs @@ -1,11 +1,12 @@ using System.Data; -using Bit.Core.Entities; -using Bit.Core.Repositories; using Bit.Core.Settings; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Repositories; +using Bit.Infrastructure.Dapper.Repositories; using Dapper; using Microsoft.Data.SqlClient; -namespace Bit.Infrastructure.Dapper.Repositories; +namespace Bit.Infrastructure.Dapper.Vault.Repositories; public class FolderRepository : Repository, IFolderRepository { diff --git a/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs index 2ec4fca7e..a058e6fb3 100644 --- a/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs +++ b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs @@ -1,8 +1,10 @@ using Bit.Core.Enums; using Bit.Core.Repositories; using Bit.Core.SecretsManager.Repositories; +using Bit.Core.Vault.Repositories; using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Infrastructure.EntityFramework.SecretsManager.Repositories; +using Bit.Infrastructure.EntityFramework.Vault.Repositories; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Infrastructure.EntityFramework/Models/CollectionCipher.cs b/src/Infrastructure.EntityFramework/Models/CollectionCipher.cs index 93d1deae1..4058ddc03 100644 --- a/src/Infrastructure.EntityFramework/Models/CollectionCipher.cs +++ b/src/Infrastructure.EntityFramework/Models/CollectionCipher.cs @@ -1,4 +1,5 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Vault.Models; namespace Bit.Infrastructure.EntityFramework.Models; diff --git a/src/Infrastructure.EntityFramework/Models/Folder.cs b/src/Infrastructure.EntityFramework/Models/Folder.cs deleted file mode 100644 index 466833785..000000000 --- a/src/Infrastructure.EntityFramework/Models/Folder.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AutoMapper; - -namespace Bit.Infrastructure.EntityFramework.Models; - -public class Folder : Core.Entities.Folder -{ - public virtual User User { get; set; } -} - -public class FolderMapperProfile : Profile -{ - public FolderMapperProfile() - { - CreateMap().ReverseMap(); - } -} diff --git a/src/Infrastructure.EntityFramework/Models/Organization.cs b/src/Infrastructure.EntityFramework/Models/Organization.cs index fca548545..a94802c90 100644 --- a/src/Infrastructure.EntityFramework/Models/Organization.cs +++ b/src/Infrastructure.EntityFramework/Models/Organization.cs @@ -1,4 +1,5 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Vault.Models; namespace Bit.Infrastructure.EntityFramework.Models; diff --git a/src/Infrastructure.EntityFramework/Models/User.cs b/src/Infrastructure.EntityFramework/Models/User.cs index 6c06c1946..02aa5f3ee 100644 --- a/src/Infrastructure.EntityFramework/Models/User.cs +++ b/src/Infrastructure.EntityFramework/Models/User.cs @@ -1,4 +1,5 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Vault.Models; namespace Bit.Infrastructure.EntityFramework.Models; diff --git a/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs b/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs index e782960d8..be6a46af6 100644 --- a/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs +++ b/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs @@ -2,6 +2,7 @@ using Bit.Infrastructure.EntityFramework.Converters; using Bit.Infrastructure.EntityFramework.Models; using Bit.Infrastructure.EntityFramework.SecretsManager.Models; +using Bit.Infrastructure.EntityFramework.Vault.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; diff --git a/src/Infrastructure.EntityFramework/Repositories/EventRepository.cs b/src/Infrastructure.EntityFramework/Repositories/EventRepository.cs index cb49f8535..a2e56b370 100644 --- a/src/Infrastructure.EntityFramework/Repositories/EventRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/EventRepository.cs @@ -6,7 +6,7 @@ using Bit.Infrastructure.EntityFramework.Repositories.Queries; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using Cipher = Bit.Core.Entities.Cipher; +using Cipher = Bit.Core.Vault.Entities.Cipher; namespace Bit.Infrastructure.EntityFramework.Repositories; diff --git a/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByCipherIdQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByCipherIdQuery.cs index 570f3a249..e6a486d33 100644 --- a/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByCipherIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/EventReadPageByCipherIdQuery.cs @@ -1,5 +1,5 @@ -using Bit.Core.Entities; -using Bit.Core.Models.Data; +using Bit.Core.Models.Data; +using Bit.Core.Vault.Entities; using Event = Bit.Infrastructure.EntityFramework.Models.Event; namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; diff --git a/src/Infrastructure.EntityFramework/Repositories/Queries/UserCipherDetailsQuery.cs b/src/Infrastructure.EntityFramework/Repositories/Queries/UserCipherDetailsQuery.cs index dd0353304..25b8192ff 100644 --- a/src/Infrastructure.EntityFramework/Repositories/Queries/UserCipherDetailsQuery.cs +++ b/src/Infrastructure.EntityFramework/Repositories/Queries/UserCipherDetailsQuery.cs @@ -1,6 +1,7 @@ using System.Text.Json; using Bit.Core.Enums; -using Core.Models.Data; +using Bit.Core.Vault.Models.Data; +using Bit.Infrastructure.EntityFramework.Vault.Models; namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; @@ -76,7 +77,7 @@ public class UserCipherDetailsQuery : IQuery return union; } - private static Guid? GetFolderId(Guid? userId, Models.Cipher cipher) + private static Guid? GetFolderId(Guid? userId, Cipher cipher) { if (userId.HasValue && !string.IsNullOrWhiteSpace(cipher.Folders)) { diff --git a/src/Infrastructure.EntityFramework/Models/Cipher.cs b/src/Infrastructure.EntityFramework/Vault/Models/Cipher.cs similarity index 57% rename from src/Infrastructure.EntityFramework/Models/Cipher.cs rename to src/Infrastructure.EntityFramework/Vault/Models/Cipher.cs index ec5ddc53d..6a316911a 100644 --- a/src/Infrastructure.EntityFramework/Models/Cipher.cs +++ b/src/Infrastructure.EntityFramework/Vault/Models/Cipher.cs @@ -1,8 +1,9 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.Vault.Models; -public class Cipher : Core.Entities.Cipher +public class Cipher : Core.Vault.Entities.Cipher { public virtual User User { get; set; } public virtual Organization Organization { get; set; } @@ -13,6 +14,6 @@ public class CipherMapperProfile : Profile { public CipherMapperProfile() { - CreateMap().ReverseMap(); + CreateMap().ReverseMap(); } } diff --git a/src/Infrastructure.EntityFramework/Vault/Models/Folder.cs b/src/Infrastructure.EntityFramework/Vault/Models/Folder.cs new file mode 100644 index 000000000..e27161384 --- /dev/null +++ b/src/Infrastructure.EntityFramework/Vault/Models/Folder.cs @@ -0,0 +1,17 @@ +using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; + +namespace Bit.Infrastructure.EntityFramework.Vault.Models; + +public class Folder : Core.Vault.Entities.Folder +{ + public virtual User User { get; set; } +} + +public class FolderMapperProfile : Profile +{ + public FolderMapperProfile() + { + CreateMap().ReverseMap(); + } +} diff --git a/src/Infrastructure.EntityFramework/Repositories/CipherRepository.cs b/src/Infrastructure.EntityFramework/Vault/Repositories/CipherRepository.cs similarity index 94% rename from src/Infrastructure.EntityFramework/Repositories/CipherRepository.cs rename to src/Infrastructure.EntityFramework/Vault/Repositories/CipherRepository.cs index 49b407018..a435859da 100644 --- a/src/Infrastructure.EntityFramework/Repositories/CipherRepository.cs +++ b/src/Infrastructure.EntityFramework/Vault/Repositories/CipherRepository.cs @@ -1,11 +1,15 @@ using AutoMapper; using Bit.Core.Enums; -using Bit.Core.Models.Data; -using Bit.Core.Repositories; using Bit.Core.Utilities; +using Bit.Core.Vault.Enums; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Repositories; using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Infrastructure.EntityFramework.Repositories.Queries; -using Core.Models.Data; +using Bit.Infrastructure.EntityFramework.Repositories.Vault.Queries; +using Bit.Infrastructure.EntityFramework.Vault.Models; +using Bit.Infrastructure.EntityFramework.Vault.Repositories.Queries; using LinqToDB.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; @@ -13,15 +17,15 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using User = Bit.Core.Entities.User; -namespace Bit.Infrastructure.EntityFramework.Repositories; +namespace Bit.Infrastructure.EntityFramework.Vault.Repositories; -public class CipherRepository : Repository, ICipherRepository +public class CipherRepository : Repository, ICipherRepository { public CipherRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Ciphers) { } - public override async Task CreateAsync(Core.Entities.Cipher cipher) + public override async Task CreateAsync(Core.Vault.Entities.Cipher cipher) { cipher = await base.CreateAsync(cipher); using (var scope = ServiceScopeFactory.CreateScope()) @@ -40,7 +44,7 @@ public class CipherRepository : Repository, return cipher; } - public override async Task DeleteAsync(Core.Entities.Cipher cipher) + public override async Task DeleteAsync(Core.Vault.Entities.Cipher cipher) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -74,7 +78,7 @@ public class CipherRepository : Repository, } } - public async Task CreateAsync(Core.Entities.Cipher cipher, IEnumerable collectionIds) + public async Task CreateAsync(Core.Vault.Entities.Cipher cipher, IEnumerable collectionIds) { cipher = await CreateAsync(cipher); using (var scope = ServiceScopeFactory.CreateScope()) @@ -105,7 +109,7 @@ public class CipherRepository : Repository, cipher.Folders = cipher.FolderId.HasValue ? $"{{{userIdKey}:\"{cipher.FolderId}\"}}" : null; - var entity = Mapper.Map((Core.Entities.Cipher)cipher); + var entity = Mapper.Map((Core.Vault.Entities.Cipher)cipher); await dbContext.AddAsync(entity); if (cipher.OrganizationId.HasValue) @@ -134,7 +138,7 @@ public class CipherRepository : Repository, } } - public async Task CreateAsync(IEnumerable ciphers, IEnumerable folders) + public async Task CreateAsync(IEnumerable ciphers, IEnumerable folders) { if (!ciphers.Any()) { @@ -153,7 +157,7 @@ public class CipherRepository : Repository, } } - public async Task CreateAsync(IEnumerable ciphers, IEnumerable collections, IEnumerable collectionCiphers) + public async Task CreateAsync(IEnumerable ciphers, IEnumerable collections, IEnumerable collectionCiphers) { if (!ciphers.Any()) { @@ -317,14 +321,14 @@ public class CipherRepository : Repository, } } - public async Task> GetManyByOrganizationIdAsync(Guid organizationId) + public async Task> GetManyByOrganizationIdAsync(Guid organizationId) { using (var scope = ServiceScopeFactory.CreateScope()) { var dbContext = GetDatabaseContext(scope); var query = dbContext.Ciphers.Where(x => !x.UserId.HasValue && x.OrganizationId == organizationId); var data = await query.ToListAsync(); - return Mapper.Map>(data); + return Mapper.Map>(data); } } @@ -465,7 +469,7 @@ public class CipherRepository : Repository, cipher.Favorites = JsonConvert.SerializeObject(folders); } } - var mappedEntity = Mapper.Map((Core.Entities.Cipher)cipher); + var mappedEntity = Mapper.Map((Core.Vault.Entities.Cipher)cipher); dbContext.Entry(entity).CurrentValues.SetValues(mappedEntity); if (cipher.OrganizationId.HasValue) @@ -545,7 +549,7 @@ public class CipherRepository : Repository, return 0; } - public async Task ReplaceAsync(Core.Entities.Cipher cipher, IEnumerable collectionIds) + public async Task ReplaceAsync(Core.Vault.Entities.Cipher cipher, IEnumerable collectionIds) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -714,7 +718,7 @@ public class CipherRepository : Repository, } } - public async Task UpdateCiphersAsync(Guid userId, IEnumerable ciphers) + public async Task UpdateCiphersAsync(Guid userId, IEnumerable ciphers) { if (!ciphers.Any()) { @@ -766,7 +770,7 @@ public class CipherRepository : Repository, } } - public async Task UpdateUserKeysAndCiphersAsync(User user, IEnumerable ciphers, IEnumerable folders, IEnumerable sends) + public async Task UpdateUserKeysAndCiphersAsync(User user, IEnumerable ciphers, IEnumerable folders, IEnumerable sends) { using (var scope = ServiceScopeFactory.CreateScope()) { diff --git a/src/Infrastructure.EntityFramework/Repositories/FolderRepository.cs b/src/Infrastructure.EntityFramework/Vault/Repositories/FolderRepository.cs similarity index 59% rename from src/Infrastructure.EntityFramework/Repositories/FolderRepository.cs rename to src/Infrastructure.EntityFramework/Vault/Repositories/FolderRepository.cs index 9f1f862bf..42b79a45e 100644 --- a/src/Infrastructure.EntityFramework/Repositories/FolderRepository.cs +++ b/src/Infrastructure.EntityFramework/Vault/Repositories/FolderRepository.cs @@ -1,18 +1,19 @@ using AutoMapper; -using Bit.Core.Repositories; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Core.Vault.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Vault.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -namespace Bit.Infrastructure.EntityFramework.Repositories; +namespace Bit.Infrastructure.EntityFramework.Vault.Repositories; -public class FolderRepository : Repository, IFolderRepository +public class FolderRepository : Repository, IFolderRepository { public FolderRepository(IServiceScopeFactory serviceScopeFactory, IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.Folders) { } - public async Task GetByIdAsync(Guid id, Guid userId) + public async Task GetByIdAsync(Guid id, Guid userId) { var folder = await base.GetByIdAsync(id); if (folder == null || folder.UserId != userId) @@ -23,7 +24,7 @@ public class FolderRepository : Repository, return folder; } - public async Task> GetManyByUserIdAsync(Guid userId) + public async Task> GetManyByUserIdAsync(Guid userId) { using (var scope = ServiceScopeFactory.CreateScope()) { @@ -32,7 +33,7 @@ public class FolderRepository : Repository, where f.UserId == userId select f; var folders = await query.ToListAsync(); - return Mapper.Map>(folders); + return Mapper.Map>(folders); } } } diff --git a/src/Infrastructure.EntityFramework/Repositories/Queries/CipherDetailsQuery.cs b/src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherDetailsQuery.cs similarity index 86% rename from src/Infrastructure.EntityFramework/Repositories/Queries/CipherDetailsQuery.cs rename to src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherDetailsQuery.cs index b9affcf94..49cbc20f4 100644 --- a/src/Infrastructure.EntityFramework/Repositories/Queries/CipherDetailsQuery.cs +++ b/src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherDetailsQuery.cs @@ -1,7 +1,9 @@ using Bit.Core.Utilities; -using Core.Models.Data; +using Bit.Core.Vault.Models.Data; +using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; -namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; +namespace Bit.Infrastructure.EntityFramework.Vault.Repositories.Queries; public class CipherDetailsQuery : IQuery { diff --git a/src/Infrastructure.EntityFramework/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs b/src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs similarity index 85% rename from src/Infrastructure.EntityFramework/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs rename to src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs index b93954a52..f0ab4779e 100644 --- a/src/Infrastructure.EntityFramework/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherOrganizationDetailsReadByIdQuery.cs @@ -1,6 +1,8 @@ -using Core.Models.Data; +using Bit.Core.Vault.Models.Data; +using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; -namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; +namespace Bit.Infrastructure.EntityFramework.Vault.Repositories.Queries; public class CipherOrganizationDetailsReadByIdQuery : IQuery { diff --git a/src/Infrastructure.EntityFramework/Repositories/Queries/CipherOrganizationDetailsReadByOrganizationIdQuery.cs b/src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherOrganizationDetailsReadByOrganizationIdQuery.cs similarity index 88% rename from src/Infrastructure.EntityFramework/Repositories/Queries/CipherOrganizationDetailsReadByOrganizationIdQuery.cs rename to src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherOrganizationDetailsReadByOrganizationIdQuery.cs index 78ccc59b3..e00752a3c 100644 --- a/src/Infrastructure.EntityFramework/Repositories/Queries/CipherOrganizationDetailsReadByOrganizationIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherOrganizationDetailsReadByOrganizationIdQuery.cs @@ -1,6 +1,7 @@ -using Core.Models.Data; +using Bit.Core.Vault.Models.Data; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; -namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; +namespace Bit.Infrastructure.EntityFramework.Repositories.Vault.Queries; public class CipherOrganizationDetailsReadByOrganizationIdQuery : IQuery { diff --git a/src/Infrastructure.EntityFramework/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs b/src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs similarity index 92% rename from src/Infrastructure.EntityFramework/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs rename to src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs index f4a3e8694..3f0a17180 100644 --- a/src/Infrastructure.EntityFramework/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs +++ b/src/Infrastructure.EntityFramework/Vault/Repositories/Queries/CipherReadCanEditByIdUserIdQuery.cs @@ -1,7 +1,9 @@ using Bit.Core.Enums; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Repositories.Queries; +using Bit.Infrastructure.EntityFramework.Vault.Models; -namespace Bit.Infrastructure.EntityFramework.Repositories.Queries; +namespace Bit.Infrastructure.EntityFramework.Vault.Repositories.Queries; public class CipherReadCanEditByIdUserIdQuery : IQuery { diff --git a/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs b/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs index 2d50e48b2..4bc730a7d 100644 --- a/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs +++ b/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs @@ -16,6 +16,7 @@ using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Tokens; using Bit.Core.Utilities; +using Bit.Core.Vault.Services; using Bit.Infrastructure.Dapper; using IdentityModel; using IdentityServer4.AccessTokenValidation; diff --git a/src/Sql/Sql.sqlproj b/src/Sql/Sql.sqlproj index 39a4a06a9..76f639f87 100644 --- a/src/Sql/Sql.sqlproj +++ b/src/Sql/Sql.sqlproj @@ -74,11 +74,16 @@ + + + + + + + - - @@ -87,35 +92,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -177,11 +153,6 @@ - - - - - @@ -262,6 +233,7 @@ + @@ -274,8 +246,10 @@ + + @@ -377,7 +351,6 @@ - @@ -385,7 +358,6 @@ - @@ -413,12 +385,10 @@ - - @@ -454,9 +424,46 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Sql/dbo/Functions/CipherDetails.sql b/src/Sql/Vault/dbo/Functions/CipherDetails.sql similarity index 100% rename from src/Sql/dbo/Functions/CipherDetails.sql rename to src/Sql/Vault/dbo/Functions/CipherDetails.sql diff --git a/src/Sql/dbo/Functions/UserCipherDetails.sql b/src/Sql/Vault/dbo/Functions/UserCipherDetails.sql similarity index 100% rename from src/Sql/dbo/Functions/UserCipherDetails.sql rename to src/Sql/Vault/dbo/Functions/UserCipherDetails.sql diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_Create.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_Create.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/CipherDetails_Create.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_Create.sql diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_CreateWithCollections.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_CreateWithCollections.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/CipherDetails_CreateWithCollections.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_CreateWithCollections.sql diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByIdUserId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadByIdUserId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/CipherDetails_ReadByIdUserId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadByIdUserId.sql diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadByUserId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/CipherDetails_ReadByUserId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadByUserId.sql diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_ReadWithoutOrganizationsByUserId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadWithoutOrganizationsByUserId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/CipherDetails_ReadWithoutOrganizationsByUserId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadWithoutOrganizationsByUserId.sql diff --git a/src/Sql/dbo/Stored Procedures/CipherDetails_Update.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_Update.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/CipherDetails_Update.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_Update.sql diff --git a/src/Sql/dbo/Stored Procedures/CipherOrganizationDetails_ReadById.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/CipherOrganizationDetails_ReadById.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadById.sql diff --git a/src/Sql/dbo/Stored Procedures/CipherOrganizationDetails_ReadByOrganizationId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadByOrganizationId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/CipherOrganizationDetails_ReadByOrganizationId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadByOrganizationId.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_Create.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Create.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_Create.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Create.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_CreateWithCollections.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_CreateWithCollections.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_CreateWithCollections.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_CreateWithCollections.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_Delete.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Delete.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_Delete.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Delete.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_DeleteAttachment.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteAttachment.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_DeleteAttachment.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteAttachment.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_DeleteById.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_DeleteById.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteById.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_DeleteByIdsOrganizationId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByIdsOrganizationId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_DeleteByIdsOrganizationId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByIdsOrganizationId.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_DeleteByOrganizationId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByOrganizationId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_DeleteByOrganizationId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByOrganizationId.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_DeleteByUserId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByUserId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_DeleteByUserId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByUserId.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_DeleteDeleted.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteDeleted.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_DeleteDeleted.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteDeleted.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_Move.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Move.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_Move.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Move.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_ReadById.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_ReadById.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadById.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_ReadByOrganizationId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadByOrganizationId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_ReadByOrganizationId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadByOrganizationId.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_ReadCanEditByIdUserId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadCanEditByIdUserId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_ReadCanEditByIdUserId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadCanEditByIdUserId.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_Restore.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Restore.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_Restore.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Restore.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_SoftDelete.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_SoftDelete.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_SoftDelete.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_SoftDelete.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_SoftDeleteByIdsOrganizationId.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_SoftDeleteByIdsOrganizationId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_SoftDeleteByIdsOrganizationId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_SoftDeleteByIdsOrganizationId.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_Update.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Update.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_Update.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Update.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_UpdateAttachment.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateAttachment.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_UpdateAttachment.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateAttachment.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_UpdateCollections.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateCollections.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_UpdateCollections.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateCollections.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_UpdatePartial.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdatePartial.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_UpdatePartial.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdatePartial.sql diff --git a/src/Sql/dbo/Stored Procedures/Cipher_UpdateWithCollections.sql b/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateWithCollections.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Cipher_UpdateWithCollections.sql rename to src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateWithCollections.sql diff --git a/src/Sql/dbo/Stored Procedures/Folder_Create.sql b/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_Create.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Folder_Create.sql rename to src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_Create.sql diff --git a/src/Sql/dbo/Stored Procedures/Folder_DeleteById.sql b/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_DeleteById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Folder_DeleteById.sql rename to src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_DeleteById.sql diff --git a/src/Sql/dbo/Stored Procedures/Folder_ReadById.sql b/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_ReadById.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Folder_ReadById.sql rename to src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_ReadById.sql diff --git a/src/Sql/dbo/Stored Procedures/Folder_ReadByUserId.sql b/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_ReadByUserId.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Folder_ReadByUserId.sql rename to src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_ReadByUserId.sql diff --git a/src/Sql/dbo/Stored Procedures/Folder_Update.sql b/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_Update.sql similarity index 100% rename from src/Sql/dbo/Stored Procedures/Folder_Update.sql rename to src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_Update.sql diff --git a/src/Sql/dbo/Tables/Cipher.sql b/src/Sql/Vault/dbo/Tables/Cipher.sql similarity index 100% rename from src/Sql/dbo/Tables/Cipher.sql rename to src/Sql/Vault/dbo/Tables/Cipher.sql diff --git a/src/Sql/dbo/Tables/Folder.sql b/src/Sql/Vault/dbo/Tables/Folder.sql similarity index 100% rename from src/Sql/dbo/Tables/Folder.sql rename to src/Sql/Vault/dbo/Tables/Folder.sql diff --git a/src/Sql/dbo/Views/CipherView.sql b/src/Sql/Vault/dbo/Views/CipherView.sql similarity index 100% rename from src/Sql/dbo/Views/CipherView.sql rename to src/Sql/Vault/dbo/Views/CipherView.sql diff --git a/src/Sql/dbo/Views/FolderView.sql b/src/Sql/Vault/dbo/Views/FolderView.sql similarity index 100% rename from src/Sql/dbo/Views/FolderView.sql rename to src/Sql/Vault/dbo/Views/FolderView.sql diff --git a/test/Api.Test/Controllers/AccountsControllerTests.cs b/test/Api.Test/Controllers/AccountsControllerTests.cs index 142cc0b4d..1f7ec5f41 100644 --- a/test/Api.Test/Controllers/AccountsControllerTests.cs +++ b/test/Api.Test/Controllers/AccountsControllerTests.cs @@ -9,6 +9,7 @@ using Bit.Core.Models.Data; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Settings; +using Bit.Core.Vault.Repositories; using Microsoft.AspNetCore.Identity; using NSubstitute; using Xunit; diff --git a/test/Api.Test/Controllers/CiphersControllerTests.cs b/test/Api.Test/Vault/Controllers/CiphersControllerTests.cs similarity index 86% rename from test/Api.Test/Controllers/CiphersControllerTests.cs rename to test/Api.Test/Vault/Controllers/CiphersControllerTests.cs index 8a8861a73..0ca085d2b 100644 --- a/test/Api.Test/Controllers/CiphersControllerTests.cs +++ b/test/Api.Test/Vault/Controllers/CiphersControllerTests.cs @@ -1,11 +1,11 @@ using System.Security.Claims; -using Bit.Api.Controllers; -using Bit.Api.Models.Request; -using Bit.Core.Repositories; +using Bit.Api.Vault.Controllers; +using Bit.Api.Vault.Models.Request; using Bit.Core.Services; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using Core.Models.Data; using NSubstitute; using Xunit; @@ -29,7 +29,7 @@ public class CiphersControllerTests { Favorite = isFavorite, FolderId = folderId, - Type = Core.Enums.CipherType.SecureNote, + Type = Core.Vault.Enums.CipherType.SecureNote, Data = "{}" }; diff --git a/test/Api.Test/Controllers/SyncControllerTests.cs b/test/Api.Test/Vault/Controllers/SyncControllerTests.cs similarity index 98% rename from test/Api.Test/Controllers/SyncControllerTests.cs rename to test/Api.Test/Vault/Controllers/SyncControllerTests.cs index 0b48af7fe..c21bc38ab 100644 --- a/test/Api.Test/Controllers/SyncControllerTests.cs +++ b/test/Api.Test/Vault/Controllers/SyncControllerTests.cs @@ -1,8 +1,8 @@ using System.Security.Claims; using System.Text.Json; using AutoFixture; -using Bit.Api.Controllers; -using Bit.Api.Models.Response; +using Bit.Api.Vault.Controllers; +using Bit.Api.Vault.Models.Response; using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Enums.Provider; @@ -12,9 +12,11 @@ using Bit.Core.Models.Data.Organizations.OrganizationUsers; using Bit.Core.Repositories; using Bit.Core.Services; using Bit.Core.Utilities; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; -using Core.Models.Data; using NSubstitute; using NSubstitute.ReturnsExtensions; using Xunit; diff --git a/test/Core.Test/Services/LocalAttachmentStorageServiceTests.cs b/test/Core.Test/Services/LocalAttachmentStorageServiceTests.cs index 660ee7197..c389b2319 100644 --- a/test/Core.Test/Services/LocalAttachmentStorageServiceTests.cs +++ b/test/Core.Test/Services/LocalAttachmentStorageServiceTests.cs @@ -1,11 +1,11 @@ using System.Text; using AutoFixture; -using Bit.Core.Entities; -using Bit.Core.Models.Data; -using Bit.Core.Services; using Bit.Core.Settings; using Bit.Core.Test.AutoFixture.CipherAttachmentMetaData; using Bit.Core.Test.AutoFixture.CipherFixtures; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Services; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using NSubstitute; diff --git a/test/Core.Test/AutoFixture/CipherAttachmentMetaDataFixtures.cs b/test/Core.Test/Vault/AutoFixture/CipherAttachmentMetaDataFixtures.cs similarity index 97% rename from test/Core.Test/AutoFixture/CipherAttachmentMetaDataFixtures.cs rename to test/Core.Test/Vault/AutoFixture/CipherAttachmentMetaDataFixtures.cs index ef18dcd5f..2aa1e0076 100644 --- a/test/Core.Test/AutoFixture/CipherAttachmentMetaDataFixtures.cs +++ b/test/Core.Test/Vault/AutoFixture/CipherAttachmentMetaDataFixtures.cs @@ -1,6 +1,6 @@ using AutoFixture; using AutoFixture.Dsl; -using Bit.Core.Models.Data; +using Bit.Core.Vault.Models.Data; namespace Bit.Core.Test.AutoFixture.CipherAttachmentMetaData; diff --git a/test/Core.Test/AutoFixture/CipherFixtures.cs b/test/Core.Test/Vault/AutoFixture/CipherFixtures.cs similarity index 95% rename from test/Core.Test/AutoFixture/CipherFixtures.cs rename to test/Core.Test/Vault/AutoFixture/CipherFixtures.cs index ae883c5fa..d3fe5f7f8 100644 --- a/test/Core.Test/AutoFixture/CipherFixtures.cs +++ b/test/Core.Test/Vault/AutoFixture/CipherFixtures.cs @@ -1,7 +1,7 @@ using AutoFixture; -using Bit.Core.Entities; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; using Bit.Test.Common.AutoFixture.Attributes; -using Core.Models.Data; namespace Bit.Core.Test.AutoFixture.CipherFixtures; diff --git a/test/Core.Test/Models/CipherTests.cs b/test/Core.Test/Vault/Models/CipherTests.cs similarity index 95% rename from test/Core.Test/Models/CipherTests.cs rename to test/Core.Test/Vault/Models/CipherTests.cs index fa9521b6c..6d557825c 100644 --- a/test/Core.Test/Models/CipherTests.cs +++ b/test/Core.Test/Vault/Models/CipherTests.cs @@ -1,6 +1,6 @@ using System.Text.Json; -using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.CipherFixtures; +using Bit.Core.Vault.Entities; using Bit.Test.Common.AutoFixture.Attributes; using Xunit; diff --git a/test/Core.Test/Services/AzureAttachmentStorageServiceTests.cs b/test/Core.Test/Vault/Services/AzureAttachmentStorageServiceTests.cs similarity index 93% rename from test/Core.Test/Services/AzureAttachmentStorageServiceTests.cs rename to test/Core.Test/Vault/Services/AzureAttachmentStorageServiceTests.cs index 21a5fa3f8..6c1a65011 100644 --- a/test/Core.Test/Services/AzureAttachmentStorageServiceTests.cs +++ b/test/Core.Test/Vault/Services/AzureAttachmentStorageServiceTests.cs @@ -1,5 +1,5 @@ -using Bit.Core.Services; -using Bit.Core.Settings; +using Bit.Core.Settings; +using Bit.Core.Vault.Services; using Microsoft.Extensions.Logging; using NSubstitute; using Xunit; diff --git a/test/Core.Test/Services/CipherServiceTests.cs b/test/Core.Test/Vault/Services/CipherServiceTests.cs similarity index 98% rename from test/Core.Test/Services/CipherServiceTests.cs rename to test/Core.Test/Vault/Services/CipherServiceTests.cs index ed47954f3..8ab34a130 100644 --- a/test/Core.Test/Services/CipherServiceTests.cs +++ b/test/Core.Test/Vault/Services/CipherServiceTests.cs @@ -1,12 +1,14 @@ using Bit.Core.Entities; using Bit.Core.Exceptions; using Bit.Core.Repositories; -using Bit.Core.Services; using Bit.Core.Test.AutoFixture.CipherFixtures; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Repositories; +using Bit.Core.Vault.Services; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; using Castle.Core.Internal; -using Core.Models.Data; using NSubstitute; using Xunit; diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/CollectionCipherFixtures.cs b/test/Infrastructure.EFIntegration.Test/AutoFixture/CollectionCipherFixtures.cs index 89ffccb2b..4af375890 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/CollectionCipherFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/AutoFixture/CollectionCipherFixtures.cs @@ -4,6 +4,7 @@ using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.UserFixtures; using Bit.Infrastructure.EFIntegration.Test.AutoFixture.Relays; using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Vault.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs b/test/Infrastructure.EFIntegration.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs index 1fecaa6b9..26b56fa37 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs @@ -6,6 +6,7 @@ using Bit.Core.Settings; using Bit.Infrastructure.EFIntegration.Test.Helpers; using Bit.Infrastructure.EntityFramework.Models; using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Vault.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Moq; diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/CipherCompare.cs b/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/CipherCompare.cs index 230b51dd6..96b11ab63 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/CipherCompare.cs +++ b/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/CipherCompare.cs @@ -1,5 +1,5 @@ using System.Diagnostics.CodeAnalysis; -using Bit.Core.Entities; +using Bit.Core.Vault.Entities; namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/FolderCompare.cs b/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/FolderCompare.cs index 2bdb71385..56818cf11 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/FolderCompare.cs +++ b/test/Infrastructure.EFIntegration.Test/Repositories/EqualityComparers/FolderCompare.cs @@ -1,5 +1,5 @@ using System.Diagnostics.CodeAnalysis; -using Bit.Core.Entities; +using Bit.Core.Vault.Entities; namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/CipherFixtures.cs b/test/Infrastructure.EFIntegration.Test/Vault/AutoFixture/CipherFixtures.cs similarity index 97% rename from test/Infrastructure.EFIntegration.Test/AutoFixture/CipherFixtures.cs rename to test/Infrastructure.EFIntegration.Test/Vault/AutoFixture/CipherFixtures.cs index 71b89dc98..ebce1e8b5 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/CipherFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/Vault/AutoFixture/CipherFixtures.cs @@ -1,11 +1,12 @@ using System.Text.Json; using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Entities; -using Bit.Core.Models.Data; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Models.Data; using Bit.Infrastructure.EFIntegration.Test.AutoFixture.Relays; using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Vault.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; diff --git a/test/Infrastructure.EFIntegration.Test/AutoFixture/FolderFixtures.cs b/test/Infrastructure.EFIntegration.Test/Vault/AutoFixture/FolderFixtures.cs similarity index 95% rename from test/Infrastructure.EFIntegration.Test/AutoFixture/FolderFixtures.cs rename to test/Infrastructure.EFIntegration.Test/Vault/AutoFixture/FolderFixtures.cs index 884933ffd..a20696e44 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/FolderFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/Vault/AutoFixture/FolderFixtures.cs @@ -1,9 +1,10 @@ using AutoFixture; using AutoFixture.Kernel; -using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.UserFixtures; +using Bit.Core.Vault.Entities; using Bit.Infrastructure.EFIntegration.Test.AutoFixture.Relays; using Bit.Infrastructure.EntityFramework.Repositories; +using Bit.Infrastructure.EntityFramework.Vault.Repositories; using Bit.Test.Common.AutoFixture; using Bit.Test.Common.AutoFixture.Attributes; diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/CipherRepositoryTests.cs b/test/Infrastructure.EFIntegration.Test/Vault/Repositories/CipherRepositoryTests.cs similarity index 86% rename from test/Infrastructure.EFIntegration.Test/Repositories/CipherRepositoryTests.cs rename to test/Infrastructure.EFIntegration.Test/Vault/Repositories/CipherRepositoryTests.cs index 0de2196a8..36f92f906 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/CipherRepositoryTests.cs +++ b/test/Infrastructure.EFIntegration.Test/Vault/Repositories/CipherRepositoryTests.cs @@ -1,6 +1,7 @@ using Bit.Core.Entities; using Bit.Core.Models.Data; using Bit.Core.Test.AutoFixture.Attributes; +using Bit.Core.Vault.Entities; using Bit.Infrastructure.EFIntegration.Test.AutoFixture; using Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; using Bit.Infrastructure.EntityFramework.Repositories.Queries; @@ -8,14 +9,16 @@ using Bit.Test.Common.AutoFixture.Attributes; using LinqToDB; using Xunit; using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using EfVaultRepo = Bit.Infrastructure.EntityFramework.Vault.Repositories; using SqlRepo = Bit.Infrastructure.Dapper.Repositories; +using SqlVaultRepo = Bit.Infrastructure.Dapper.Vault.Repositories; namespace Bit.Infrastructure.EFIntegration.Test.Repositories; public class CipherRepositoryTests { [Theory(Skip = "Run ad-hoc"), EfUserCipherCustomize, BitAutoData] - public async void RefreshDb(List suts) + public async void RefreshDb(List suts) { foreach (var sut in suts) { @@ -25,21 +28,21 @@ public class CipherRepositoryTests [CiSkippedTheory, EfUserCipherCustomize, BitAutoData] public Task UserCipher_CreateAsync_Works_DataMatches(Cipher cipher, User user, Organization org, - CipherCompare equalityComparer, List suts, List efUserRepos, - List efOrgRepos, SqlRepo.CipherRepository sqlCipherRepo, + CipherCompare equalityComparer, List suts, List efUserRepos, + List efOrgRepos, SqlVaultRepo.CipherRepository sqlCipherRepo, SqlRepo.UserRepository sqlUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo) => CreateAsync_Works_DataMatches( cipher, user, org, equalityComparer, suts, efUserRepos, efOrgRepos, sqlCipherRepo, sqlUserRepo, sqlOrgRepo); [CiSkippedTheory, EfOrganizationCipherCustomize, BitAutoData] public Task OrganizationCipher_CreateAsync_Works_DataMatches(Cipher cipher, User user, Organization org, - CipherCompare equalityComparer, List suts, List efUserRepos, - List efOrgRepos, SqlRepo.CipherRepository sqlCipherRepo, + CipherCompare equalityComparer, List suts, List efUserRepos, + List efOrgRepos, SqlVaultRepo.CipherRepository sqlCipherRepo, SqlRepo.UserRepository sqlUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo) => CreateAsync_Works_DataMatches( cipher, user, org, equalityComparer, suts, efUserRepos, efOrgRepos, sqlCipherRepo, sqlUserRepo, sqlOrgRepo); private async Task CreateAsync_Works_DataMatches(Cipher cipher, User user, Organization org, - CipherCompare equalityComparer, List suts, List efUserRepos, - List efOrgRepos, SqlRepo.CipherRepository sqlCipherRepo, + CipherCompare equalityComparer, List suts, List efUserRepos, + List efOrgRepos, SqlVaultRepo.CipherRepository sqlCipherRepo, SqlRepo.UserRepository sqlUserRepo, SqlRepo.OrganizationRepository sqlOrgRepo) { var savedCiphers = new List(); @@ -83,7 +86,7 @@ public class CipherRepositoryTests } [CiSkippedTheory, EfUserCipherCustomize, BitAutoData] - public async void CreateAsync_BumpsUserAccountRevisionDate(Cipher cipher, User user, List suts, List efUserRepos) + public async void CreateAsync_BumpsUserAccountRevisionDate(Cipher cipher, User user, List suts, List efUserRepos) { var bumpedUsers = new List(); foreach (var sut in suts) @@ -107,7 +110,7 @@ public class CipherRepositoryTests [CiSkippedTheory, EfOrganizationCipherCustomize, BitAutoData] public async void CreateAsync_BumpsOrgUserAccountRevisionDates(Cipher cipher, List users, - List orgUsers, Collection collection, Organization org, List suts, List efUserRepos, List efOrgRepos, + List orgUsers, Collection collection, Organization org, List suts, List efUserRepos, List efOrgRepos, List efOrgUserRepos, List efCollectionRepos) { var savedCiphers = new List(); @@ -172,7 +175,7 @@ public class CipherRepositoryTests Cipher cipher, User user, Organization org, - List suts, + List suts, List efUserRepos, List efOrgRepos ) => await DeleteAsync_CipherIsDeleted(cipher, user, org, suts, efUserRepos, efOrgRepos); @@ -181,7 +184,7 @@ public class CipherRepositoryTests Cipher cipher, User user, Organization org, - List suts, + List suts, List efUserRepos, List efOrgRepos ) @@ -194,7 +197,7 @@ public class CipherRepositoryTests Cipher cipher, User user, Organization org, - List suts, + List suts, List efUserRepos, List efOrgRepos ) diff --git a/test/Infrastructure.EFIntegration.Test/Repositories/FolderRepositoryTests.cs b/test/Infrastructure.EFIntegration.Test/Vault/Repositories/FolderRepositoryTests.cs similarity index 85% rename from test/Infrastructure.EFIntegration.Test/Repositories/FolderRepositoryTests.cs rename to test/Infrastructure.EFIntegration.Test/Vault/Repositories/FolderRepositoryTests.cs index 53edbd3c4..7cbae311a 100644 --- a/test/Infrastructure.EFIntegration.Test/Repositories/FolderRepositoryTests.cs +++ b/test/Infrastructure.EFIntegration.Test/Vault/Repositories/FolderRepositoryTests.cs @@ -1,10 +1,13 @@ using Bit.Core.Entities; using Bit.Core.Test.AutoFixture.Attributes; +using Bit.Core.Vault.Entities; using Bit.Infrastructure.EFIntegration.Test.AutoFixture; using Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers; using Xunit; using EfRepo = Bit.Infrastructure.EntityFramework.Repositories; +using EfVaultRepo = Bit.Infrastructure.EntityFramework.Vault.Repositories; using SqlRepo = Bit.Infrastructure.Dapper.Repositories; +using SqlVaultRepo = Bit.Infrastructure.Dapper.Vault.Repositories; namespace Bit.Infrastructure.EFIntegration.Test.Repositories; @@ -15,9 +18,9 @@ public class FolderRepositoryTests Folder folder, User user, FolderCompare equalityComparer, - List suts, + List suts, List efUserRepos, - SqlRepo.FolderRepository sqlFolderRepo, + SqlVaultRepo.FolderRepository sqlFolderRepo, SqlRepo.UserRepository sqlUserRepo) { var savedFolders = new List(); diff --git a/test/Infrastructure.IntegrationTest/Repositories/CipherRepositoryTests.cs b/test/Infrastructure.IntegrationTest/Vault/Repositories/CipherRepositoryTests.cs similarity index 95% rename from test/Infrastructure.IntegrationTest/Repositories/CipherRepositoryTests.cs rename to test/Infrastructure.IntegrationTest/Vault/Repositories/CipherRepositoryTests.cs index 0e5da71e4..95c1085ac 100644 --- a/test/Infrastructure.IntegrationTest/Repositories/CipherRepositoryTests.cs +++ b/test/Infrastructure.IntegrationTest/Vault/Repositories/CipherRepositoryTests.cs @@ -1,7 +1,10 @@ using Bit.Core.Entities; using Bit.Core.Enums; using Bit.Core.Repositories; -using Core.Models.Data; +using Bit.Core.Vault.Entities; +using Bit.Core.Vault.Enums; +using Bit.Core.Vault.Models.Data; +using Bit.Core.Vault.Repositories; using Xunit; namespace Bit.Infrastructure.IntegrationTest.Repositories;