From 4f2fb2ccf57025402aff821bc45a5bda50f75ebf Mon Sep 17 00:00:00 2001 From: Jake Fink Date: Tue, 18 Apr 2023 08:45:02 -0400 Subject: [PATCH] [PM-1188] Move EF auth models for code ownership (#2859) * [PM-1188] move ef auth files to auth folder * [PM-1188] rename ef models namespace * [PM-1188] fix auth ef model imports * [PM-1188] fix ef model usings --- .../{ => Auth}/Models/AuthRequest.cs | 3 ++- .../{ => Auth}/Models/EmergencyAccess.cs | 3 ++- src/Infrastructure.EntityFramework/{ => Auth}/Models/Grant.cs | 2 +- .../{ => Auth}/Models/SsoConfig.cs | 3 ++- .../{ => Auth}/Models/SsoUser.cs | 3 ++- .../Auth/Repositories/AuthRequestRepository.cs | 2 +- .../Auth/Repositories/EmergencyAccessRepository.cs | 2 +- .../Auth/Repositories/GrantRepository.cs | 2 +- .../Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs | 2 +- .../Auth/Repositories/SsoConfigRepository.cs | 2 +- .../Auth/Repositories/SsoUserRepository.cs | 2 +- src/Infrastructure.EntityFramework/Models/Organization.cs | 1 + src/Infrastructure.EntityFramework/Models/User.cs | 1 + .../Repositories/DatabaseContext.cs | 1 + .../Auth/AutoFixture/GrantFixtures.cs | 2 +- .../AutoFixture/EntityFrameworkRepositoryFixtures.cs | 1 + 16 files changed, 20 insertions(+), 12 deletions(-) rename src/Infrastructure.EntityFramework/{ => Auth}/Models/AuthRequest.cs (77%) rename src/Infrastructure.EntityFramework/{ => Auth}/Models/EmergencyAccess.cs (78%) rename src/Infrastructure.EntityFramework/{ => Auth}/Models/Grant.cs (79%) rename src/Infrastructure.EntityFramework/{ => Auth}/Models/SsoConfig.cs (74%) rename src/Infrastructure.EntityFramework/{ => Auth}/Models/SsoUser.cs (76%) diff --git a/src/Infrastructure.EntityFramework/Models/AuthRequest.cs b/src/Infrastructure.EntityFramework/Auth/Models/AuthRequest.cs similarity index 77% rename from src/Infrastructure.EntityFramework/Models/AuthRequest.cs rename to src/Infrastructure.EntityFramework/Auth/Models/AuthRequest.cs index f02e81a98e..e0e0f7b03f 100644 --- a/src/Infrastructure.EntityFramework/Models/AuthRequest.cs +++ b/src/Infrastructure.EntityFramework/Auth/Models/AuthRequest.cs @@ -1,6 +1,7 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.Auth.Models; public class AuthRequest : Core.Auth.Entities.AuthRequest { diff --git a/src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs b/src/Infrastructure.EntityFramework/Auth/Models/EmergencyAccess.cs similarity index 78% rename from src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs rename to src/Infrastructure.EntityFramework/Auth/Models/EmergencyAccess.cs index 3c74490e5c..3ee09e9f83 100644 --- a/src/Infrastructure.EntityFramework/Models/EmergencyAccess.cs +++ b/src/Infrastructure.EntityFramework/Auth/Models/EmergencyAccess.cs @@ -1,6 +1,7 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.Auth.Models; public class EmergencyAccess : Core.Auth.Entities.EmergencyAccess { diff --git a/src/Infrastructure.EntityFramework/Models/Grant.cs b/src/Infrastructure.EntityFramework/Auth/Models/Grant.cs similarity index 79% rename from src/Infrastructure.EntityFramework/Models/Grant.cs rename to src/Infrastructure.EntityFramework/Auth/Models/Grant.cs index 6e3569fd9b..9540efaa50 100644 --- a/src/Infrastructure.EntityFramework/Models/Grant.cs +++ b/src/Infrastructure.EntityFramework/Auth/Models/Grant.cs @@ -1,6 +1,6 @@ using AutoMapper; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.Auth.Models; public class Grant : Core.Auth.Entities.Grant { diff --git a/src/Infrastructure.EntityFramework/Models/SsoConfig.cs b/src/Infrastructure.EntityFramework/Auth/Models/SsoConfig.cs similarity index 74% rename from src/Infrastructure.EntityFramework/Models/SsoConfig.cs rename to src/Infrastructure.EntityFramework/Auth/Models/SsoConfig.cs index 43897678a4..bba641d510 100644 --- a/src/Infrastructure.EntityFramework/Models/SsoConfig.cs +++ b/src/Infrastructure.EntityFramework/Auth/Models/SsoConfig.cs @@ -1,6 +1,7 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.Auth.Models; public class SsoConfig : Core.Auth.Entities.SsoConfig { diff --git a/src/Infrastructure.EntityFramework/Models/SsoUser.cs b/src/Infrastructure.EntityFramework/Auth/Models/SsoUser.cs similarity index 76% rename from src/Infrastructure.EntityFramework/Models/SsoUser.cs rename to src/Infrastructure.EntityFramework/Auth/Models/SsoUser.cs index 31d751e4a1..8d8dd8cafe 100644 --- a/src/Infrastructure.EntityFramework/Models/SsoUser.cs +++ b/src/Infrastructure.EntityFramework/Auth/Models/SsoUser.cs @@ -1,6 +1,7 @@ using AutoMapper; +using Bit.Infrastructure.EntityFramework.Models; -namespace Bit.Infrastructure.EntityFramework.Models; +namespace Bit.Infrastructure.EntityFramework.Auth.Models; public class SsoUser : Core.Auth.Entities.SsoUser { diff --git a/src/Infrastructure.EntityFramework/Auth/Repositories/AuthRequestRepository.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/AuthRequestRepository.cs index 4ed2d069cf..399933e00d 100644 --- a/src/Infrastructure.EntityFramework/Auth/Repositories/AuthRequestRepository.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/AuthRequestRepository.cs @@ -1,6 +1,6 @@ using AutoMapper; using Bit.Core.Repositories; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Auth.Models; using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Infrastructure.EntityFramework/Auth/Repositories/EmergencyAccessRepository.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/EmergencyAccessRepository.cs index 10b7ac0b7f..f00ff2eecf 100644 --- a/src/Infrastructure.EntityFramework/Auth/Repositories/EmergencyAccessRepository.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/EmergencyAccessRepository.cs @@ -2,8 +2,8 @@ using Bit.Core.Auth.Enums; using Bit.Core.Auth.Models.Data; using Bit.Core.Repositories; +using Bit.Infrastructure.EntityFramework.Auth.Models; using Bit.Infrastructure.EntityFramework.Auth.Repositories.Queries; -using Bit.Infrastructure.EntityFramework.Models; using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Infrastructure.EntityFramework/Auth/Repositories/GrantRepository.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/GrantRepository.cs index 7c86f69661..3026ad0eb9 100644 --- a/src/Infrastructure.EntityFramework/Auth/Repositories/GrantRepository.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/GrantRepository.cs @@ -1,6 +1,6 @@ using AutoMapper; using Bit.Core.Auth.Repositories; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Auth.Models; using Bit.Infrastructure.EntityFramework.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs index 6c967b860a..0cdf19f2d3 100644 --- a/src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/Queries/EmergencyAccessReadCountByGrantorIdEmailQuery.cs @@ -1,4 +1,4 @@ -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Auth.Models; using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Infrastructure.EntityFramework.Repositories.Queries; diff --git a/src/Infrastructure.EntityFramework/Auth/Repositories/SsoConfigRepository.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/SsoConfigRepository.cs index bf5b460647..3113f31dee 100644 --- a/src/Infrastructure.EntityFramework/Auth/Repositories/SsoConfigRepository.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/SsoConfigRepository.cs @@ -1,6 +1,6 @@ using AutoMapper; using Bit.Core.Auth.Repositories; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Auth.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Infrastructure.EntityFramework/Auth/Repositories/SsoUserRepository.cs b/src/Infrastructure.EntityFramework/Auth/Repositories/SsoUserRepository.cs index be705d04f5..278c5e8709 100644 --- a/src/Infrastructure.EntityFramework/Auth/Repositories/SsoUserRepository.cs +++ b/src/Infrastructure.EntityFramework/Auth/Repositories/SsoUserRepository.cs @@ -1,6 +1,6 @@ using AutoMapper; using Bit.Core.Auth.Repositories; -using Bit.Infrastructure.EntityFramework.Models; +using Bit.Infrastructure.EntityFramework.Auth.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Infrastructure.EntityFramework/Models/Organization.cs b/src/Infrastructure.EntityFramework/Models/Organization.cs index a94802c900..d1679b4d6e 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.Auth.Models; 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 02aa5f3eea..9e33d9edf6 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.Auth.Models; 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 be6a46af6b..428b2eed58 100644 --- a/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs +++ b/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs @@ -1,4 +1,5 @@ using Bit.Core; +using Bit.Infrastructure.EntityFramework.Auth.Models; using Bit.Infrastructure.EntityFramework.Converters; using Bit.Infrastructure.EntityFramework.Models; using Bit.Infrastructure.EntityFramework.SecretsManager.Models; diff --git a/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/GrantFixtures.cs b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/GrantFixtures.cs index 880a391fce..41596594c8 100644 --- a/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/GrantFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/Auth/AutoFixture/GrantFixtures.cs @@ -2,8 +2,8 @@ using AutoFixture.Kernel; using Bit.Infrastructure.EFIntegration.Test.AutoFixture; using Bit.Infrastructure.EFIntegration.Test.AutoFixture.Relays; +using Bit.Infrastructure.EntityFramework.Auth.Models; using Bit.Infrastructure.EntityFramework.Auth.Repositories; -using Bit.Infrastructure.EntityFramework.Models; 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 26b56fa375..c1325af216 100644 --- a/test/Infrastructure.EFIntegration.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs +++ b/test/Infrastructure.EFIntegration.Test/AutoFixture/EntityFrameworkRepositoryFixtures.cs @@ -4,6 +4,7 @@ using AutoFixture.Kernel; using AutoMapper; using Bit.Core.Settings; using Bit.Infrastructure.EFIntegration.Test.Helpers; +using Bit.Infrastructure.EntityFramework.Auth.Models; using Bit.Infrastructure.EntityFramework.Models; using Bit.Infrastructure.EntityFramework.Repositories; using Bit.Infrastructure.EntityFramework.Vault.Models;