2022-12-14 09:28:51 -05:00
// <auto-generated />
using System ;
using Bit.Infrastructure.EntityFramework.Repositories ;
using Microsoft.EntityFrameworkCore ;
using Microsoft.EntityFrameworkCore.Infrastructure ;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion ;
#nullable disable
namespace Bit.SqliteMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
partial class DatabaseContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel ( ModelBuilder modelBuilder )
{
#pragma warning disable 612 , 618
2024-09-02 15:01:32 +10:00
modelBuilder . HasAnnotation ( "ProductVersion" , "8.0.8" ) ;
2022-12-14 09:28:51 -05:00
2025-06-16 17:32:36 -04:00
modelBuilder . Entity ( "Bit.Core.Dirt.Reports.Models.Data.OrganizationMemberBaseDetail" , b = >
{
b . Property < Guid > ( "CipherId" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "CollectionId" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "CollectionName" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Email" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "GroupId" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "GroupName" )
. HasColumnType ( "TEXT" ) ;
b . Property < bool? > ( "HidePasswords" )
. HasColumnType ( "INTEGER" ) ;
b . Property < bool? > ( "Manage" )
. HasColumnType ( "INTEGER" ) ;
b . Property < bool? > ( "ReadOnly" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "ResetPasswordKey" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "TwoFactorProviders" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "UserGuid" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "UserName" )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "UsesKeyConnector" )
. HasColumnType ( "INTEGER" ) ;
b . ToTable ( "OrganizationMemberBaseDetails" ) ;
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "AllowAdminAccessToAllCollectionItems" )
. HasColumnType ( "INTEGER" )
. HasDefaultValue ( true ) ;
b . Property < string > ( "BillingEmail" )
2024-07-04 21:14:37 -04:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 256 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessAddress1" )
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessAddress2" )
. HasMaxLength ( 50 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessAddress3" )
. HasMaxLength ( 50 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessCountry" )
. HasMaxLength ( 2 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessName" )
. HasMaxLength ( 50 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessTaxNumber" )
. HasMaxLength ( 30 )
2023-06-15 14:54:08 -07:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "Enabled" )
. HasColumnType ( "INTEGER" ) ;
b . Property < DateTime ? > ( "ExpirationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < byte? > ( "Gateway" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "GatewayCustomerId" )
2022-12-14 09:28:51 -05:00
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "GatewaySubscriptionId" )
. HasMaxLength ( 50 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Identifier" )
. HasMaxLength ( 50 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "LicenseKey" )
. HasMaxLength ( 100 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2024-10-03 13:43:54 -04:00
b . Property < bool > ( "LimitCollectionCreation" )
. HasColumnType ( "INTEGER" ) ;
b . Property < bool > ( "LimitCollectionDeletion" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2025-01-21 15:51:34 -05:00
b . Property < bool > ( "LimitItemDeletion" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < int? > ( "MaxAutoscaleSeats" )
. HasColumnType ( "INTEGER" ) ;
2023-06-15 14:54:08 -07:00
2023-12-13 07:03:42 -08:00
b . Property < int? > ( "MaxAutoscaleSmSeats" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < int? > ( "MaxAutoscaleSmServiceAccounts" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < short? > ( "MaxCollections" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < short? > ( "MaxStorageGb" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Name" )
2024-07-04 21:14:37 -04:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 50 )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime ? > ( "OwnersNotifiedOfAutoscaling" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Plan" )
2024-07-04 21:14:37 -04:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 50 )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < byte > ( "PlanType" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "PrivateKey" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "PublicKey" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "ReferenceData" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < int? > ( "Seats" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "SelfHost" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < int? > ( "SmSeats" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < int? > ( "SmServiceAccounts" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < byte > ( "Status" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < long? > ( "Storage" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2025-07-31 07:54:51 -05:00
b . Property < bool > ( "SyncSeats" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "TwoFactorProviders" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "Use2fa" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2025-04-16 17:27:58 +02:00
b . Property < bool > ( "UseAdminSponsoredFamilies" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UseApi" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2025-10-20 07:27:18 -05:00
b . Property < bool > ( "UseAutomaticUserConfirmation" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UseCustomPermissions" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UseDirectory" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2026-01-07 11:42:10 -05:00
b . Property < bool > ( "UseDisableSmAdsForUsers" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UseEvents" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UseGroups" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UseKeyConnector" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2025-05-15 10:42:51 -04:00
b . Property < bool > ( "UseOrganizationDomains" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UsePasswordManager" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2025-12-01 12:31:36 -06:00
b . Property < bool > ( "UsePhishingBlocker" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UsePolicies" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UseResetPassword" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
2024-12-05 10:46:01 -06:00
b . Property < bool > ( "UseRiskInsights" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UseScim" )
. HasColumnType ( "INTEGER" ) ;
b . Property < bool > ( "UseSecretsManager" )
. HasColumnType ( "INTEGER" ) ;
b . Property < bool > ( "UseSso" )
. HasColumnType ( "INTEGER" ) ;
b . Property < bool > ( "UseTotp" )
. HasColumnType ( "INTEGER" ) ;
b . Property < bool > ( "UsersGetPremium" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" ) ;
2024-01-10 12:03:16 -06:00
b . HasIndex ( "Id" , "Enabled" )
2025-12-16 10:31:56 +00:00
. HasAnnotation ( "Npgsql:IndexInclude" , new [ ] { "UseTotp" , "UsersGetPremium" } ) ;
2024-01-10 12:03:16 -06:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "Organization" , ( string ) null ) ;
2023-05-01 09:32:06 -04:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Policy" , b = >
2023-05-01 09:32:06 -04:00
{
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-05-01 09:32:06 -04:00
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Data" )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "Enabled" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
2023-05-01 09:32:06 -04:00
b . HasKey ( "Id" ) ;
2024-01-10 12:03:16 -06:00
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "OrganizationId" , "Type" )
. IsUnique ( )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "Policy" , ( string ) null ) ;
2023-05-01 09:32:06 -04:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.Provider" , b = >
2023-05-01 09:32:06 -04:00
{
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "Id" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BillingEmail" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BillingPhone" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessAddress1" )
2023-05-01 09:32:06 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessAddress2" )
. HasColumnType ( "TEXT" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessAddress3" )
. HasColumnType ( "TEXT" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessCountry" )
. HasColumnType ( "TEXT" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessName" )
. HasColumnType ( "TEXT" ) ;
2023-05-01 09:32:06 -04:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "BusinessTaxNumber" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
2025-03-05 14:59:15 -05:00
b . Property < string > ( "DiscountId" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "Enabled" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2024-06-05 11:42:02 -07:00
b . Property < byte? > ( "Gateway" )
. HasColumnType ( "INTEGER" ) ;
2024-03-21 11:15:49 -04:00
b . Property < string > ( "GatewayCustomerId" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "GatewaySubscriptionId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < string > ( "Name" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < byte > ( "Status" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "UseEvents" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" ) ;
b . ToTable ( "Provider" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.ProviderOrganization" , b = >
2022-12-14 09:28:51 -05:00
{
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "Id" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Key" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "ProviderId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "RevisionDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Settings" )
. HasColumnType ( "TEXT" ) ;
[AC-1373] Flexible Collections (#3245)
* [AC-1117] Add manage permission (#3126)
* Update sql files to add Manage permission
* Add migration script
* Rename collection manage migration file to remove duplicate migration date
* Migrations
* Add manage to models
* Add manage to repository
* Add constraint to Manage columns
* Migration lint fixes
* Add manage to OrganizationUserUserDetails_ReadWithCollectionsById
* Add missing manage fields
* Add 'Manage' to UserCollectionDetails
* Use CREATE OR ALTER where possible
* [AC-1374] Limit collection creation/deletion to Owner/Admin (#3145)
* feat: update org table with new column, write migration, refs AC-1374
* feat: update views with new column, refs AC-1374
* feat: Alter sprocs (org create/update) to include new column, refs AC-1374
* feat: update entity/data/request/response models to handle new column, refs AC-1374
* feat: update necessary Provider related views during migration, refs AC-1374
* fix: update org create to default new column to false, refs AC-1374
* feat: added new API/request model for collection management and removed property from update request model, refs AC-1374
* fix: renamed migration script to be after secrets manage beta column changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: add ef migrations to reflect mssql changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: update API signature to accept Guid and explain Cd verbiage, refs AC-1374
* fix: merge conflict resolution
* [AC-1174] CollectionUser and CollectionGroup authorization handlers (#3194)
* [AC-1174] Introduce BulkAuthorizationHandler.cs
* [AC-1174] Introduce CollectionUserAuthorizationHandler
* [AC-1174] Add CreateForNewCollection CollectionUser requirement
* [AC-1174] Add some more details to CollectionCustomization
* [AC-1174] Formatting
* [AC-1174] Add CollectionGroupOperation.cs
* [AC-1174] Introduce CollectionGroupAuthorizationHandler.cs
* [AC-1174] Cleanup CollectionFixture customization
Implement and use re-usable extension method to support seeded Guids
* [AC-1174] Introduce WithValueFromList AutoFixtureExtensions
Modify CollectionCustomization to use multiple organization Ids for auto generated test data
* [AC-1174] Simplify CollectionUserAuthorizationHandler.cs
Modify the authorization handler to only perform authorization logic. Validation logic will need to be handled by any calling commands/controllers instead.
* [AC-1174] Introduce shared CollectionAccessAuthorizationHandlerBase
A shared base authorization handler was created for both CollectionUser and CollectionGroup resources, as they share the same underlying management authorization logic.
* [AC-1174] Update CollectionUserAuthorizationHandler and CollectionGroupAuthorizationHandler to use the new CollectionAccessAuthorizationHandlerBase class
* [AC-1174] Formatting
* [AC-1174] Cleanup typo and redundant ToList() call
* [AC-1174] Add check for provider users
* [AC-1174] Reduce nested loops
* [AC-1174] Introduce ICollectionAccess.cs
* [AC-1174] Remove individual CollectionGroup and CollectionUser auth handlers and use base class instead
* [AC-1174] Tweak unit test to fail minimally
* [AC-1174] Reorganize authorization handlers in Core project
* [AC-1174] Introduce new AddCoreAuthorizationHandlers() extension method
* [AC-1174] Move CollectionAccessAuthorizationHandler into Api project
* [AC-1174] Move CollectionFixture to Vault folder
* [AC-1174] Rename operation to CreateUpdateDelete
* [AC-1174] Require single organization for collection access authorization handler
- Add requirement that all target collections must belong to the same organization
- Simplify logic related to multiple organizations
- Update tests and helpers
- Use ToHashSet to improve lookup time
* [AC-1174] Fix null reference exception
* [AC-1174] Throw bad request exception when collections belong to different organizations
* [AC-1174] Switch to CollectionAuthorizationHandler instead of CollectionAccessAuthorizationHandler to reduce complexity
* Fix improper merge conflict resolution
* fix: add permission check for collection management api, refs AC-1647 (#3252)
* [AC-1125] Enforce org setting for creating/deleting collections (#3241)
* [AC-1117] Add manage permission (#3126)
* Update sql files to add Manage permission
* Add migration script
* Rename collection manage migration file to remove duplicate migration date
* Migrations
* Add manage to models
* Add manage to repository
* Add constraint to Manage columns
* Migration lint fixes
* Add manage to OrganizationUserUserDetails_ReadWithCollectionsById
* Add missing manage fields
* Add 'Manage' to UserCollectionDetails
* Use CREATE OR ALTER where possible
* [AC-1374] Limit collection creation/deletion to Owner/Admin (#3145)
* feat: update org table with new column, write migration, refs AC-1374
* feat: update views with new column, refs AC-1374
* feat: Alter sprocs (org create/update) to include new column, refs AC-1374
* feat: update entity/data/request/response models to handle new column, refs AC-1374
* feat: update necessary Provider related views during migration, refs AC-1374
* fix: update org create to default new column to false, refs AC-1374
* feat: added new API/request model for collection management and removed property from update request model, refs AC-1374
* fix: renamed migration script to be after secrets manage beta column changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: add ef migrations to reflect mssql changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: update API signature to accept Guid and explain Cd verbiage, refs AC-1374
* feat: created collection auth handler/operations, added LimitCollectionCdOwnerAdmin to CurrentContentOrganization, refs AC-1125
* feat: create vault service collection extensions and register with base services, refs AC-1125
* feat: deprecated CurrentContext.CreateNewCollections, refs AC-1125
* feat: deprecate DeleteAnyCollection for single resource usages, refs AC-1125
* feat: move service registration to api, update references, refs AC-1125
* feat: add bulk delete authorization handler, refs AC-1125
* feat: always assign user and give manage access on create, refs AC-1125
* fix: updated CurrentContextOrganization type, refs AC-1125
* feat: combined existing collection authorization handlers/operations, refs AC-1125
* fix: OrganizationServiceTests -> CurrentContentOrganization typo, refs AC-1125
* fix: format, refs AC-1125
* fix: update collection controller tests, refs AC-1125
* fix: dotnet format, refs AC-1125
* feat: removed extra BulkAuthorizationHandler, refs AC-1125
* fix: dotnet format, refs AC-1125
* fix: change string to guid for org id, update bulk delete request model, refs AC-1125
* fix: remove delete many collection check, refs AC-1125
* fix: clean up collection auth handler, refs AC-1125
* fix: format fix for CollectionOperations, refs AC-1125
* fix: removed unnecessary owner check, add org null check to custom permission validation, refs AC-1125
* fix: remove unused methods in CurrentContext, refs AC-1125
* fix: removed obsolete test, fixed failling delete many test, refs AC-1125
* fix: CollectionAuthorizationHandlerTests fixes, refs AC-1125
* fix: OrganizationServiceTests fix broken test by mocking GetOrganization, refs AC-1125
* fix: CollectionAuthorizationHandler - remove unused repository, refs AC-1125
* feat: moved UserId null check to common method, refs AC-1125
* fix: updated auth handler tests to remove dependency on requirement for common code checks, refs AC-1125
* feat: updated conditionals/comments for create/delete methods within colleciton auth handler, refs AC-1125
* feat: added create/delete collection auth handler success methods, refs AC-1125
* fix: new up permissions to prevent excessive null checks, refs AC-1125
* fix: remove old reference to CreateNewCollections, refs AC-1125
* fix: typo within ViewAssignedCollections method, refs AC-1125
---------
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
* refactor: remove organizationId from CollectionBulkDeleteRequestModel, refs AC-1649 (#3282)
* [AC-1174] Bulk Collection Management (#3229)
* [AC-1174] Update SelectionReadOnlyRequestModel to use Guid for Id property
* [AC-1174] Introduce initial bulk-access collection endpoint
* [AC-1174] Introduce BulkAddCollectionAccessCommand and validation logic/tests
* [AC-1174] Add CreateOrUpdateAccessMany method to CollectionRepository
* [AC-1174] Add event logs for bulk add collection access command
* [AC-1174] Add User_BumpAccountRevisionDateByCollectionIds and database migration script
* [AC-1174] Implement EF repository method
* [AC-1174] Improve null checks
* [AC-1174] Remove unnecessary BulkCollectionAccessRequestModel helpers
* [AC-1174] Add unit tests for new controller endpoint
* [AC-1174] Fix formatting
* [AC-1174] Remove comment
* [AC-1174] Remove redundant organizationId parameter
* [AC-1174] Ensure user and group Ids are distinct
* [AC-1174] Cleanup tests based on PR feedback
* [AC-1174] Formatting
* [AC-1174] Update CollectionGroup alias in the sproc
* [AC-1174] Add some additional comments to SQL sproc
* [AC-1174] Add comment explaining additional SaveChangesAsync call
---------
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* [AC-1646] Rename LimitCollectionCdOwnerAdmin column (#3300)
* Rename LimitCollectionCdOwnerAdmin -> LimitCollectionCreationDeletion
* Rename and bump migration script
* [AC-1666] Removed EditAnyCollection from Create/Delete permission checks (#3301)
* fix: remove EditAnyCollection from Create/Delete permission check, refs AC-1666
* fix: updated comment, refs AC-1666
* [AC-1669] Bug - Remove obsolete assignUserId from CollectionService.SaveAsync(...) (#3312)
* fix: remove AssignUserId from CollectionService.SaveAsync, refs AC-1669
* fix: add manage access conditional before creating collection, refs AC-1669
* fix: move access logic for create/update, fix all tests, refs AC-1669
* fix: add CollectionAccessSelection fixture, update tests, update bad reqeuest message, refs AC-1669
* fix: format, refs AC-1669
* fix: update null params with specific arg.is null checks, refs Ac-1669
* fix: update attribute class name, refs AC-1669
* [AC-1713] [Flexible collections] Add feature flags to server (#3334)
* Add feature flags for FlexibleCollections and BulkCollectionAccess
* Flag new routes and behaviour
---------
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
* Add joint codeownership for auth handlers (#3346)
* [AC-1717] Update default values for LimitCollectionCreationDeletion (#3365)
* Change default value in organization create sproc to 1
* Drop old column name still present in some QA instances
* Set LimitCollectionCreationDeletion value in code based on feature flag
* Fix: add missing namespace after merging in master
* Fix: add missing namespace after merging in master
* [AC-1683] Fix DB migrations for new Manage permission (#3307)
* [AC-1683] Update migration script and introduce V2 procedures and types
* [AC-1683] Update repository calls to use new V2 procedures / types
* [AC-1684] Update bulk add collection migration script to use new V2 type
* [AC-1683] Undo Manage changes to more original procedures
* [AC-1683] Restore whitespace changes
* [AC-1683] Clarify comments regarding explicit column lists
* [AC-1683] Update migration script dates
* [AC-1683] Split the migration script for readability
* [AC-1683] Re-name SelectReadOnlyArray_V2 to CollectionAccessSelectionType
* [AC-1648] [Flexible Collections] Bump migration scripts before feature branch merge (#3371)
* Bump dates on sql migration scripts
* Bump date on ef migrations
---------
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
Co-authored-by: Shane Melton <smelton@bitwarden.com>
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
2023-11-01 19:30:52 +10:00
2023-12-13 07:03:42 -08:00
b . HasKey ( "Id" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "OrganizationId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "ProviderId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "ProviderOrganization" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.ProviderUser" , b = >
2022-12-14 09:28:51 -05:00
{
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "Id" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Email" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Key" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Permissions" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "ProviderId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Status" )
[AC-1373] Flexible Collections (#3245)
* [AC-1117] Add manage permission (#3126)
* Update sql files to add Manage permission
* Add migration script
* Rename collection manage migration file to remove duplicate migration date
* Migrations
* Add manage to models
* Add manage to repository
* Add constraint to Manage columns
* Migration lint fixes
* Add manage to OrganizationUserUserDetails_ReadWithCollectionsById
* Add missing manage fields
* Add 'Manage' to UserCollectionDetails
* Use CREATE OR ALTER where possible
* [AC-1374] Limit collection creation/deletion to Owner/Admin (#3145)
* feat: update org table with new column, write migration, refs AC-1374
* feat: update views with new column, refs AC-1374
* feat: Alter sprocs (org create/update) to include new column, refs AC-1374
* feat: update entity/data/request/response models to handle new column, refs AC-1374
* feat: update necessary Provider related views during migration, refs AC-1374
* fix: update org create to default new column to false, refs AC-1374
* feat: added new API/request model for collection management and removed property from update request model, refs AC-1374
* fix: renamed migration script to be after secrets manage beta column changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: add ef migrations to reflect mssql changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: update API signature to accept Guid and explain Cd verbiage, refs AC-1374
* fix: merge conflict resolution
* [AC-1174] CollectionUser and CollectionGroup authorization handlers (#3194)
* [AC-1174] Introduce BulkAuthorizationHandler.cs
* [AC-1174] Introduce CollectionUserAuthorizationHandler
* [AC-1174] Add CreateForNewCollection CollectionUser requirement
* [AC-1174] Add some more details to CollectionCustomization
* [AC-1174] Formatting
* [AC-1174] Add CollectionGroupOperation.cs
* [AC-1174] Introduce CollectionGroupAuthorizationHandler.cs
* [AC-1174] Cleanup CollectionFixture customization
Implement and use re-usable extension method to support seeded Guids
* [AC-1174] Introduce WithValueFromList AutoFixtureExtensions
Modify CollectionCustomization to use multiple organization Ids for auto generated test data
* [AC-1174] Simplify CollectionUserAuthorizationHandler.cs
Modify the authorization handler to only perform authorization logic. Validation logic will need to be handled by any calling commands/controllers instead.
* [AC-1174] Introduce shared CollectionAccessAuthorizationHandlerBase
A shared base authorization handler was created for both CollectionUser and CollectionGroup resources, as they share the same underlying management authorization logic.
* [AC-1174] Update CollectionUserAuthorizationHandler and CollectionGroupAuthorizationHandler to use the new CollectionAccessAuthorizationHandlerBase class
* [AC-1174] Formatting
* [AC-1174] Cleanup typo and redundant ToList() call
* [AC-1174] Add check for provider users
* [AC-1174] Reduce nested loops
* [AC-1174] Introduce ICollectionAccess.cs
* [AC-1174] Remove individual CollectionGroup and CollectionUser auth handlers and use base class instead
* [AC-1174] Tweak unit test to fail minimally
* [AC-1174] Reorganize authorization handlers in Core project
* [AC-1174] Introduce new AddCoreAuthorizationHandlers() extension method
* [AC-1174] Move CollectionAccessAuthorizationHandler into Api project
* [AC-1174] Move CollectionFixture to Vault folder
* [AC-1174] Rename operation to CreateUpdateDelete
* [AC-1174] Require single organization for collection access authorization handler
- Add requirement that all target collections must belong to the same organization
- Simplify logic related to multiple organizations
- Update tests and helpers
- Use ToHashSet to improve lookup time
* [AC-1174] Fix null reference exception
* [AC-1174] Throw bad request exception when collections belong to different organizations
* [AC-1174] Switch to CollectionAuthorizationHandler instead of CollectionAccessAuthorizationHandler to reduce complexity
* Fix improper merge conflict resolution
* fix: add permission check for collection management api, refs AC-1647 (#3252)
* [AC-1125] Enforce org setting for creating/deleting collections (#3241)
* [AC-1117] Add manage permission (#3126)
* Update sql files to add Manage permission
* Add migration script
* Rename collection manage migration file to remove duplicate migration date
* Migrations
* Add manage to models
* Add manage to repository
* Add constraint to Manage columns
* Migration lint fixes
* Add manage to OrganizationUserUserDetails_ReadWithCollectionsById
* Add missing manage fields
* Add 'Manage' to UserCollectionDetails
* Use CREATE OR ALTER where possible
* [AC-1374] Limit collection creation/deletion to Owner/Admin (#3145)
* feat: update org table with new column, write migration, refs AC-1374
* feat: update views with new column, refs AC-1374
* feat: Alter sprocs (org create/update) to include new column, refs AC-1374
* feat: update entity/data/request/response models to handle new column, refs AC-1374
* feat: update necessary Provider related views during migration, refs AC-1374
* fix: update org create to default new column to false, refs AC-1374
* feat: added new API/request model for collection management and removed property from update request model, refs AC-1374
* fix: renamed migration script to be after secrets manage beta column changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: add ef migrations to reflect mssql changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: update API signature to accept Guid and explain Cd verbiage, refs AC-1374
* feat: created collection auth handler/operations, added LimitCollectionCdOwnerAdmin to CurrentContentOrganization, refs AC-1125
* feat: create vault service collection extensions and register with base services, refs AC-1125
* feat: deprecated CurrentContext.CreateNewCollections, refs AC-1125
* feat: deprecate DeleteAnyCollection for single resource usages, refs AC-1125
* feat: move service registration to api, update references, refs AC-1125
* feat: add bulk delete authorization handler, refs AC-1125
* feat: always assign user and give manage access on create, refs AC-1125
* fix: updated CurrentContextOrganization type, refs AC-1125
* feat: combined existing collection authorization handlers/operations, refs AC-1125
* fix: OrganizationServiceTests -> CurrentContentOrganization typo, refs AC-1125
* fix: format, refs AC-1125
* fix: update collection controller tests, refs AC-1125
* fix: dotnet format, refs AC-1125
* feat: removed extra BulkAuthorizationHandler, refs AC-1125
* fix: dotnet format, refs AC-1125
* fix: change string to guid for org id, update bulk delete request model, refs AC-1125
* fix: remove delete many collection check, refs AC-1125
* fix: clean up collection auth handler, refs AC-1125
* fix: format fix for CollectionOperations, refs AC-1125
* fix: removed unnecessary owner check, add org null check to custom permission validation, refs AC-1125
* fix: remove unused methods in CurrentContext, refs AC-1125
* fix: removed obsolete test, fixed failling delete many test, refs AC-1125
* fix: CollectionAuthorizationHandlerTests fixes, refs AC-1125
* fix: OrganizationServiceTests fix broken test by mocking GetOrganization, refs AC-1125
* fix: CollectionAuthorizationHandler - remove unused repository, refs AC-1125
* feat: moved UserId null check to common method, refs AC-1125
* fix: updated auth handler tests to remove dependency on requirement for common code checks, refs AC-1125
* feat: updated conditionals/comments for create/delete methods within colleciton auth handler, refs AC-1125
* feat: added create/delete collection auth handler success methods, refs AC-1125
* fix: new up permissions to prevent excessive null checks, refs AC-1125
* fix: remove old reference to CreateNewCollections, refs AC-1125
* fix: typo within ViewAssignedCollections method, refs AC-1125
---------
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
* refactor: remove organizationId from CollectionBulkDeleteRequestModel, refs AC-1649 (#3282)
* [AC-1174] Bulk Collection Management (#3229)
* [AC-1174] Update SelectionReadOnlyRequestModel to use Guid for Id property
* [AC-1174] Introduce initial bulk-access collection endpoint
* [AC-1174] Introduce BulkAddCollectionAccessCommand and validation logic/tests
* [AC-1174] Add CreateOrUpdateAccessMany method to CollectionRepository
* [AC-1174] Add event logs for bulk add collection access command
* [AC-1174] Add User_BumpAccountRevisionDateByCollectionIds and database migration script
* [AC-1174] Implement EF repository method
* [AC-1174] Improve null checks
* [AC-1174] Remove unnecessary BulkCollectionAccessRequestModel helpers
* [AC-1174] Add unit tests for new controller endpoint
* [AC-1174] Fix formatting
* [AC-1174] Remove comment
* [AC-1174] Remove redundant organizationId parameter
* [AC-1174] Ensure user and group Ids are distinct
* [AC-1174] Cleanup tests based on PR feedback
* [AC-1174] Formatting
* [AC-1174] Update CollectionGroup alias in the sproc
* [AC-1174] Add some additional comments to SQL sproc
* [AC-1174] Add comment explaining additional SaveChangesAsync call
---------
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* [AC-1646] Rename LimitCollectionCdOwnerAdmin column (#3300)
* Rename LimitCollectionCdOwnerAdmin -> LimitCollectionCreationDeletion
* Rename and bump migration script
* [AC-1666] Removed EditAnyCollection from Create/Delete permission checks (#3301)
* fix: remove EditAnyCollection from Create/Delete permission check, refs AC-1666
* fix: updated comment, refs AC-1666
* [AC-1669] Bug - Remove obsolete assignUserId from CollectionService.SaveAsync(...) (#3312)
* fix: remove AssignUserId from CollectionService.SaveAsync, refs AC-1669
* fix: add manage access conditional before creating collection, refs AC-1669
* fix: move access logic for create/update, fix all tests, refs AC-1669
* fix: add CollectionAccessSelection fixture, update tests, update bad reqeuest message, refs AC-1669
* fix: format, refs AC-1669
* fix: update null params with specific arg.is null checks, refs Ac-1669
* fix: update attribute class name, refs AC-1669
* [AC-1713] [Flexible collections] Add feature flags to server (#3334)
* Add feature flags for FlexibleCollections and BulkCollectionAccess
* Flag new routes and behaviour
---------
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
* Add joint codeownership for auth handlers (#3346)
* [AC-1717] Update default values for LimitCollectionCreationDeletion (#3365)
* Change default value in organization create sproc to 1
* Drop old column name still present in some QA instances
* Set LimitCollectionCreationDeletion value in code based on feature flag
* Fix: add missing namespace after merging in master
* Fix: add missing namespace after merging in master
* [AC-1683] Fix DB migrations for new Manage permission (#3307)
* [AC-1683] Update migration script and introduce V2 procedures and types
* [AC-1683] Update repository calls to use new V2 procedures / types
* [AC-1684] Update bulk add collection migration script to use new V2 type
* [AC-1683] Undo Manage changes to more original procedures
* [AC-1683] Restore whitespace changes
* [AC-1683] Clarify comments regarding explicit column lists
* [AC-1683] Update migration script dates
* [AC-1683] Split the migration script for readability
* [AC-1683] Re-name SelectReadOnlyArray_V2 to CollectionAccessSelectionType
* [AC-1648] [Flexible Collections] Bump migration scripts before feature branch merge (#3371)
* Bump dates on sql migration scripts
* Bump date on ef migrations
---------
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
Co-authored-by: Shane Melton <smelton@bitwarden.com>
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
2023-11-01 19:30:52 +10:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < byte > ( "Type" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasKey ( "Id" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "ProviderId" ) ;
b . HasIndex ( "UserId" ) ;
b . ToTable ( "ProviderUser" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.AuthRequest" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
2023-12-13 07:03:42 -08:00
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "AccessCode" )
. HasMaxLength ( 25 )
. HasColumnType ( "TEXT" ) ;
b . Property < bool? > ( "Approved" )
. HasColumnType ( "INTEGER" ) ;
b . Property < DateTime ? > ( "AuthenticationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Key" )
2023-06-09 21:36:12 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "MasterPasswordHash" )
2023-06-09 21:36:12 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "OrganizationId" )
2023-06-09 21:36:12 -04:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "PublicKey" )
. HasColumnType ( "TEXT" ) ;
2025-03-26 11:44:05 -04:00
b . Property < string > ( "RequestCountryName" )
. HasMaxLength ( 200 )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "RequestDeviceIdentifier" )
2022-12-14 09:28:51 -05:00
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < byte > ( "RequestDeviceType" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "RequestIpAddress" )
2022-12-14 09:28:51 -05:00
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime ? > ( "ResponseDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "ResponseDeviceId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
2023-12-13 07:03:42 -08:00
b . HasIndex ( "OrganizationId" ) ;
b . HasIndex ( "ResponseDeviceId" ) ;
2022-12-14 09:28:51 -05:00
b . HasIndex ( "UserId" ) ;
2023-12-13 07:03:42 -08:00
b . ToTable ( "AuthRequest" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.EmergencyAccess" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Email" )
. HasMaxLength ( 256 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "GranteeId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "GrantorId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "KeyEncrypted" )
2023-03-02 08:50:27 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime ? > ( "LastNotificationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime ? > ( "RecoveryInitiatedDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "RevisionDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < byte > ( "Status" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
2026-01-13 18:10:01 +01:00
b . Property < short > ( "WaitTimeDays" )
2023-12-13 07:03:42 -08:00
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "GranteeId" ) ;
b . HasIndex ( "GrantorId" ) ;
b . ToTable ( "EmergencyAccess" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.Grant" , b = >
{
2023-12-28 15:04:45 -05:00
b . Property < int > ( "Id" )
. ValueGeneratedOnAdd ( )
2024-03-21 11:15:49 -04:00
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "ClientId" )
2023-12-28 15:04:45 -05:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 200 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime ? > ( "ConsumedDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Data" )
2023-12-28 15:04:45 -05:00
. IsRequired ( )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Description" )
. HasMaxLength ( 200 )
2023-02-24 16:44:33 +01:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime ? > ( "ExpirationDate" )
2023-02-24 16:44:33 +01:00
. HasColumnType ( "TEXT" ) ;
2023-12-28 15:04:45 -05:00
b . Property < string > ( "Key" )
. IsRequired ( )
. HasMaxLength ( 200 )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "SessionId" )
. HasMaxLength ( 100 )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "SubjectId" )
. HasMaxLength ( 200 )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Type" )
2023-12-28 15:04:45 -05:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 50 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-28 15:04:45 -05:00
b . HasKey ( "Id" )
2024-02-05 15:51:31 -05:00
. HasName ( "PK_Grant" )
2023-12-28 15:04:45 -05:00
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
2024-01-17 10:42:43 -06:00
b . HasIndex ( "ExpirationDate" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2023-12-28 15:04:45 -05:00
b . HasIndex ( "Key" )
. IsUnique ( ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "Grant" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.SsoConfig" , b = >
2022-12-14 09:28:51 -05:00
{
2023-12-13 07:03:42 -08:00
b . Property < long > ( "Id" )
. ValueGeneratedOnAdd ( )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Data" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "Enabled" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "OrganizationId" ) ;
2023-12-13 07:03:42 -08:00
b . ToTable ( "SsoConfig" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.SsoUser" , b = >
2022-12-14 09:28:51 -05:00
{
2023-12-13 07:03:42 -08:00
b . Property < long > ( "Id" )
. ValueGeneratedOnAdd ( )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "ExternalId" )
2025-05-27 15:18:23 +01:00
. HasMaxLength ( 300 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "OrganizationId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "UserId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . HasKey ( "Id" ) ;
2022-12-14 09:28:51 -05:00
2024-01-17 10:42:43 -06:00
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "UserId" ) ;
2022-12-14 09:28:51 -05:00
2024-01-17 10:42:43 -06:00
b . HasIndex ( "OrganizationId" , "ExternalId" )
. IsUnique ( )
. HasAnnotation ( "Npgsql:IndexInclude" , new [ ] { "UserId" } )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "OrganizationId" , "UserId" )
. IsUnique ( )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2023-12-13 07:03:42 -08:00
b . ToTable ( "SsoUser" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.WebAuthnCredential" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "AaGuid" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < int > ( "Counter" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "CredentialId" )
. HasMaxLength ( 256 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "EncryptedPrivateKey" )
. HasMaxLength ( 2000 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "EncryptedPublicKey" )
. HasMaxLength ( 2000 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "EncryptedUserKey" )
. HasMaxLength ( 2000 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Name" )
. HasMaxLength ( 50 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "PublicKey" )
. HasMaxLength ( 256 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "RevisionDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "SupportsPrf" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Type" )
. HasMaxLength ( 20 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "UserId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . HasKey ( "Id" ) ;
[AC-1373] Flexible Collections (#3245)
* [AC-1117] Add manage permission (#3126)
* Update sql files to add Manage permission
* Add migration script
* Rename collection manage migration file to remove duplicate migration date
* Migrations
* Add manage to models
* Add manage to repository
* Add constraint to Manage columns
* Migration lint fixes
* Add manage to OrganizationUserUserDetails_ReadWithCollectionsById
* Add missing manage fields
* Add 'Manage' to UserCollectionDetails
* Use CREATE OR ALTER where possible
* [AC-1374] Limit collection creation/deletion to Owner/Admin (#3145)
* feat: update org table with new column, write migration, refs AC-1374
* feat: update views with new column, refs AC-1374
* feat: Alter sprocs (org create/update) to include new column, refs AC-1374
* feat: update entity/data/request/response models to handle new column, refs AC-1374
* feat: update necessary Provider related views during migration, refs AC-1374
* fix: update org create to default new column to false, refs AC-1374
* feat: added new API/request model for collection management and removed property from update request model, refs AC-1374
* fix: renamed migration script to be after secrets manage beta column changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: add ef migrations to reflect mssql changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: update API signature to accept Guid and explain Cd verbiage, refs AC-1374
* fix: merge conflict resolution
* [AC-1174] CollectionUser and CollectionGroup authorization handlers (#3194)
* [AC-1174] Introduce BulkAuthorizationHandler.cs
* [AC-1174] Introduce CollectionUserAuthorizationHandler
* [AC-1174] Add CreateForNewCollection CollectionUser requirement
* [AC-1174] Add some more details to CollectionCustomization
* [AC-1174] Formatting
* [AC-1174] Add CollectionGroupOperation.cs
* [AC-1174] Introduce CollectionGroupAuthorizationHandler.cs
* [AC-1174] Cleanup CollectionFixture customization
Implement and use re-usable extension method to support seeded Guids
* [AC-1174] Introduce WithValueFromList AutoFixtureExtensions
Modify CollectionCustomization to use multiple organization Ids for auto generated test data
* [AC-1174] Simplify CollectionUserAuthorizationHandler.cs
Modify the authorization handler to only perform authorization logic. Validation logic will need to be handled by any calling commands/controllers instead.
* [AC-1174] Introduce shared CollectionAccessAuthorizationHandlerBase
A shared base authorization handler was created for both CollectionUser and CollectionGroup resources, as they share the same underlying management authorization logic.
* [AC-1174] Update CollectionUserAuthorizationHandler and CollectionGroupAuthorizationHandler to use the new CollectionAccessAuthorizationHandlerBase class
* [AC-1174] Formatting
* [AC-1174] Cleanup typo and redundant ToList() call
* [AC-1174] Add check for provider users
* [AC-1174] Reduce nested loops
* [AC-1174] Introduce ICollectionAccess.cs
* [AC-1174] Remove individual CollectionGroup and CollectionUser auth handlers and use base class instead
* [AC-1174] Tweak unit test to fail minimally
* [AC-1174] Reorganize authorization handlers in Core project
* [AC-1174] Introduce new AddCoreAuthorizationHandlers() extension method
* [AC-1174] Move CollectionAccessAuthorizationHandler into Api project
* [AC-1174] Move CollectionFixture to Vault folder
* [AC-1174] Rename operation to CreateUpdateDelete
* [AC-1174] Require single organization for collection access authorization handler
- Add requirement that all target collections must belong to the same organization
- Simplify logic related to multiple organizations
- Update tests and helpers
- Use ToHashSet to improve lookup time
* [AC-1174] Fix null reference exception
* [AC-1174] Throw bad request exception when collections belong to different organizations
* [AC-1174] Switch to CollectionAuthorizationHandler instead of CollectionAccessAuthorizationHandler to reduce complexity
* Fix improper merge conflict resolution
* fix: add permission check for collection management api, refs AC-1647 (#3252)
* [AC-1125] Enforce org setting for creating/deleting collections (#3241)
* [AC-1117] Add manage permission (#3126)
* Update sql files to add Manage permission
* Add migration script
* Rename collection manage migration file to remove duplicate migration date
* Migrations
* Add manage to models
* Add manage to repository
* Add constraint to Manage columns
* Migration lint fixes
* Add manage to OrganizationUserUserDetails_ReadWithCollectionsById
* Add missing manage fields
* Add 'Manage' to UserCollectionDetails
* Use CREATE OR ALTER where possible
* [AC-1374] Limit collection creation/deletion to Owner/Admin (#3145)
* feat: update org table with new column, write migration, refs AC-1374
* feat: update views with new column, refs AC-1374
* feat: Alter sprocs (org create/update) to include new column, refs AC-1374
* feat: update entity/data/request/response models to handle new column, refs AC-1374
* feat: update necessary Provider related views during migration, refs AC-1374
* fix: update org create to default new column to false, refs AC-1374
* feat: added new API/request model for collection management and removed property from update request model, refs AC-1374
* fix: renamed migration script to be after secrets manage beta column changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: add ef migrations to reflect mssql changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: update API signature to accept Guid and explain Cd verbiage, refs AC-1374
* feat: created collection auth handler/operations, added LimitCollectionCdOwnerAdmin to CurrentContentOrganization, refs AC-1125
* feat: create vault service collection extensions and register with base services, refs AC-1125
* feat: deprecated CurrentContext.CreateNewCollections, refs AC-1125
* feat: deprecate DeleteAnyCollection for single resource usages, refs AC-1125
* feat: move service registration to api, update references, refs AC-1125
* feat: add bulk delete authorization handler, refs AC-1125
* feat: always assign user and give manage access on create, refs AC-1125
* fix: updated CurrentContextOrganization type, refs AC-1125
* feat: combined existing collection authorization handlers/operations, refs AC-1125
* fix: OrganizationServiceTests -> CurrentContentOrganization typo, refs AC-1125
* fix: format, refs AC-1125
* fix: update collection controller tests, refs AC-1125
* fix: dotnet format, refs AC-1125
* feat: removed extra BulkAuthorizationHandler, refs AC-1125
* fix: dotnet format, refs AC-1125
* fix: change string to guid for org id, update bulk delete request model, refs AC-1125
* fix: remove delete many collection check, refs AC-1125
* fix: clean up collection auth handler, refs AC-1125
* fix: format fix for CollectionOperations, refs AC-1125
* fix: removed unnecessary owner check, add org null check to custom permission validation, refs AC-1125
* fix: remove unused methods in CurrentContext, refs AC-1125
* fix: removed obsolete test, fixed failling delete many test, refs AC-1125
* fix: CollectionAuthorizationHandlerTests fixes, refs AC-1125
* fix: OrganizationServiceTests fix broken test by mocking GetOrganization, refs AC-1125
* fix: CollectionAuthorizationHandler - remove unused repository, refs AC-1125
* feat: moved UserId null check to common method, refs AC-1125
* fix: updated auth handler tests to remove dependency on requirement for common code checks, refs AC-1125
* feat: updated conditionals/comments for create/delete methods within colleciton auth handler, refs AC-1125
* feat: added create/delete collection auth handler success methods, refs AC-1125
* fix: new up permissions to prevent excessive null checks, refs AC-1125
* fix: remove old reference to CreateNewCollections, refs AC-1125
* fix: typo within ViewAssignedCollections method, refs AC-1125
---------
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
* refactor: remove organizationId from CollectionBulkDeleteRequestModel, refs AC-1649 (#3282)
* [AC-1174] Bulk Collection Management (#3229)
* [AC-1174] Update SelectionReadOnlyRequestModel to use Guid for Id property
* [AC-1174] Introduce initial bulk-access collection endpoint
* [AC-1174] Introduce BulkAddCollectionAccessCommand and validation logic/tests
* [AC-1174] Add CreateOrUpdateAccessMany method to CollectionRepository
* [AC-1174] Add event logs for bulk add collection access command
* [AC-1174] Add User_BumpAccountRevisionDateByCollectionIds and database migration script
* [AC-1174] Implement EF repository method
* [AC-1174] Improve null checks
* [AC-1174] Remove unnecessary BulkCollectionAccessRequestModel helpers
* [AC-1174] Add unit tests for new controller endpoint
* [AC-1174] Fix formatting
* [AC-1174] Remove comment
* [AC-1174] Remove redundant organizationId parameter
* [AC-1174] Ensure user and group Ids are distinct
* [AC-1174] Cleanup tests based on PR feedback
* [AC-1174] Formatting
* [AC-1174] Update CollectionGroup alias in the sproc
* [AC-1174] Add some additional comments to SQL sproc
* [AC-1174] Add comment explaining additional SaveChangesAsync call
---------
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* [AC-1646] Rename LimitCollectionCdOwnerAdmin column (#3300)
* Rename LimitCollectionCdOwnerAdmin -> LimitCollectionCreationDeletion
* Rename and bump migration script
* [AC-1666] Removed EditAnyCollection from Create/Delete permission checks (#3301)
* fix: remove EditAnyCollection from Create/Delete permission check, refs AC-1666
* fix: updated comment, refs AC-1666
* [AC-1669] Bug - Remove obsolete assignUserId from CollectionService.SaveAsync(...) (#3312)
* fix: remove AssignUserId from CollectionService.SaveAsync, refs AC-1669
* fix: add manage access conditional before creating collection, refs AC-1669
* fix: move access logic for create/update, fix all tests, refs AC-1669
* fix: add CollectionAccessSelection fixture, update tests, update bad reqeuest message, refs AC-1669
* fix: format, refs AC-1669
* fix: update null params with specific arg.is null checks, refs Ac-1669
* fix: update attribute class name, refs AC-1669
* [AC-1713] [Flexible collections] Add feature flags to server (#3334)
* Add feature flags for FlexibleCollections and BulkCollectionAccess
* Flag new routes and behaviour
---------
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
* Add joint codeownership for auth handlers (#3346)
* [AC-1717] Update default values for LimitCollectionCreationDeletion (#3365)
* Change default value in organization create sproc to 1
* Drop old column name still present in some QA instances
* Set LimitCollectionCreationDeletion value in code based on feature flag
* Fix: add missing namespace after merging in master
* Fix: add missing namespace after merging in master
* [AC-1683] Fix DB migrations for new Manage permission (#3307)
* [AC-1683] Update migration script and introduce V2 procedures and types
* [AC-1683] Update repository calls to use new V2 procedures / types
* [AC-1684] Update bulk add collection migration script to use new V2 type
* [AC-1683] Undo Manage changes to more original procedures
* [AC-1683] Restore whitespace changes
* [AC-1683] Clarify comments regarding explicit column lists
* [AC-1683] Update migration script dates
* [AC-1683] Split the migration script for readability
* [AC-1683] Re-name SelectReadOnlyArray_V2 to CollectionAccessSelectionType
* [AC-1648] [Flexible Collections] Bump migration scripts before feature branch merge (#3371)
* Bump dates on sql migration scripts
* Bump date on ef migrations
---------
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
Co-authored-by: Shane Melton <smelton@bitwarden.com>
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
2023-11-01 19:30:52 +10:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "UserId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "WebAuthnCredential" , ( string ) null ) ;
} ) ;
2023-06-12 23:48:17 +01:00
2024-10-04 10:55:00 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Billing.Models.ClientOrganizationMigrationRecord" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "ExpirationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "GatewayCustomerId" )
. IsRequired ( )
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "GatewaySubscriptionId" )
. IsRequired ( )
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
b . Property < int? > ( "MaxAutoscaleSeats" )
. HasColumnType ( "INTEGER" ) ;
b . Property < short? > ( "MaxStorageGb" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "PlanType" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid > ( "ProviderId" )
. HasColumnType ( "TEXT" ) ;
b . Property < int > ( "Seats" )
. HasColumnType ( "INTEGER" ) ;
b . Property < byte > ( "Status" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "ProviderId" , "OrganizationId" )
. IsUnique ( ) ;
b . ToTable ( "ClientOrganizationMigrationRecord" , ( string ) null ) ;
} ) ;
2024-12-11 13:55:00 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Billing.Models.OrganizationInstallation" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "InstallationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "InstallationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "OrganizationInstallation" , ( string ) null ) ;
} ) ;
2024-06-06 13:25:13 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Billing.Models.ProviderInvoiceItem" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < int > ( "AssignedSeats" )
. HasColumnType ( "INTEGER" ) ;
2024-07-05 10:12:03 -04:00
b . Property < Guid ? > ( "ClientId" )
. HasColumnType ( "TEXT" ) ;
2024-06-06 13:25:13 -04:00
b . Property < string > ( "ClientName" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2024-07-02 10:08:34 -04:00
. HasMaxLength ( 50 )
2024-06-06 13:25:13 -04:00
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "Created" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "InvoiceId" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2024-07-02 10:08:34 -04:00
. HasMaxLength ( 50 )
2024-06-06 13:25:13 -04:00
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "InvoiceNumber" )
2024-07-02 10:08:34 -04:00
. HasMaxLength ( 50 )
2024-06-06 13:25:13 -04:00
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "PlanName" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2024-07-02 10:08:34 -04:00
. HasMaxLength ( 50 )
2024-06-06 13:25:13 -04:00
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "ProviderId" )
. HasColumnType ( "TEXT" ) ;
b . Property < decimal > ( "Total" )
. HasColumnType ( "TEXT" ) ;
b . Property < int > ( "UsedSeats" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "ProviderId" ) ;
b . ToTable ( "ProviderInvoiceItem" , ( string ) null ) ;
} ) ;
2024-03-21 11:15:49 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Billing.Models.ProviderPlan" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < int? > ( "AllocatedSeats" )
. HasColumnType ( "INTEGER" ) ;
b . Property < byte > ( "PlanType" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid > ( "ProviderId" )
. HasColumnType ( "TEXT" ) ;
b . Property < int? > ( "PurchasedSeats" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "SeatMinimum" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "ProviderId" ) ;
b . HasIndex ( "Id" , "PlanType" )
. IsUnique ( ) ;
b . ToTable ( "ProviderPlan" , ( string ) null ) ;
} ) ;
2025-06-23 12:12:04 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationApplication" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Applications" )
. IsRequired ( )
. HasColumnType ( "TEXT" ) ;
2025-07-02 14:56:15 -05:00
b . Property < string > ( "ContentEncryptionKey" )
. IsRequired ( )
. HasColumnType ( "TEXT" ) ;
2025-06-23 12:12:04 -05:00
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "OrganizationApplication" , ( string ) null ) ;
} ) ;
2026-01-13 18:10:01 +01:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationIntegration" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Configuration" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < int > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "OrganizationId" , "Type" )
. IsUnique ( )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "OrganizationIntegration" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationIntegrationConfiguration" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Configuration" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < int? > ( "EventType" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "Filters" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "OrganizationIntegrationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Template" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "OrganizationIntegrationId" ) ;
b . ToTable ( "OrganizationIntegrationConfiguration" , ( string ) null ) ;
} ) ;
2025-06-23 12:12:04 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationReport" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2025-10-28 11:17:45 -05:00
b . Property < int? > ( "ApplicationAtRiskCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "ApplicationCount" )
. HasColumnType ( "INTEGER" ) ;
2025-09-08 15:06:13 -05:00
b . Property < string > ( "ApplicationData" )
. HasColumnType ( "TEXT" ) ;
2025-07-02 14:56:15 -05:00
b . Property < string > ( "ContentEncryptionKey" )
. IsRequired ( )
. HasColumnType ( "TEXT" ) ;
2025-06-23 12:12:04 -05:00
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
2025-10-28 11:17:45 -05:00
b . Property < int? > ( "CriticalApplicationAtRiskCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "CriticalApplicationCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "CriticalMemberAtRiskCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "CriticalMemberCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "CriticalPasswordAtRiskCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "CriticalPasswordCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "MemberAtRiskCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "MemberCount" )
. HasColumnType ( "INTEGER" ) ;
2025-06-23 12:12:04 -05:00
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
2025-10-28 11:17:45 -05:00
b . Property < int? > ( "PasswordAtRiskCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "PasswordCount" )
. HasColumnType ( "INTEGER" ) ;
2025-06-23 12:12:04 -05:00
b . Property < string > ( "ReportData" )
. IsRequired ( )
. HasColumnType ( "TEXT" ) ;
2025-09-08 15:06:13 -05:00
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "SummaryData" )
. HasColumnType ( "TEXT" ) ;
2025-06-23 12:12:04 -05:00
b . HasKey ( "Id" ) ;
b . HasIndex ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "OrganizationReport" , ( string ) null ) ;
} ) ;
2025-06-16 17:32:36 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Uri" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "PasswordHealthReportApplication" , ( string ) null ) ;
} ) ;
2024-07-03 12:48:23 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Cache" , b = >
{
b . Property < string > ( "Id" )
. HasMaxLength ( 449 )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "AbsoluteExpiration" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "ExpiresAtTime" )
. HasColumnType ( "TEXT" ) ;
b . Property < long? > ( "SlidingExpirationInSeconds" )
. HasColumnType ( "INTEGER" ) ;
b . Property < byte [ ] > ( "Value" )
2024-07-24 09:48:09 -04:00
. IsRequired ( )
2024-07-03 12:48:23 -04:00
. HasColumnType ( "BLOB" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "ExpiresAtTime" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "Cache" , ( string ) null ) ;
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Collection" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-06-12 23:48:17 +01:00
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2025-06-09 14:50:15 -04:00
b . Property < string > ( "DefaultUserCollectionEmail" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "ExternalId" )
. HasMaxLength ( 300 )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < string > ( "Name" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "OrganizationId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "RevisionDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2025-06-09 14:50:15 -04:00
b . Property < int > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . HasKey ( "Id" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "OrganizationId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "Collection" , ( string ) null ) ;
} ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.CollectionCipher" , b = >
{
b . Property < Guid > ( "CollectionId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "CipherId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . HasKey ( "CollectionId" , "CipherId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "CipherId" ) ;
2023-07-26 15:55:28 -04:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "CollectionCipher" , ( string ) null ) ;
} ) ;
2023-04-14 11:13:16 +01:00
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.CollectionGroup" , b = >
{
b . Property < Guid > ( "CollectionId" )
. HasColumnType ( "TEXT" ) ;
2023-06-12 23:48:17 +01:00
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "GroupId" )
. HasColumnType ( "TEXT" ) ;
2023-06-12 23:48:17 +01:00
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "HidePasswords" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "Manage" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "ReadOnly" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . HasKey ( "CollectionId" , "GroupId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "GroupId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "CollectionGroups" ) ;
} ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.CollectionUser" , b = >
{
b . Property < Guid > ( "CollectionId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "OrganizationUserId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "HidePasswords" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "Manage" )
2023-06-12 23:48:17 +01:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "ReadOnly" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . HasKey ( "CollectionId" , "OrganizationUserId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "OrganizationUserId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "CollectionUsers" ) ;
} ) ;
2023-01-13 15:02:53 +01:00
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Device" , b = >
{
b . Property < Guid > ( "Id" )
. ValueGeneratedOnAdd ( )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2024-10-31 17:05:13 -04:00
b . Property < bool > ( "Active" )
. HasColumnType ( "INTEGER" )
. HasDefaultValue ( true ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "EncryptedPrivateKey" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "EncryptedPublicKey" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "EncryptedUserKey" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Identifier" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 50 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Name" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 50 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "PushToken" )
. HasMaxLength ( 255 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . HasKey ( "Id" ) ;
2024-01-10 12:03:16 -06:00
b . HasIndex ( "Identifier" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "UserId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "UserId" , "Identifier" )
. IsUnique ( )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "Device" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Event" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "ActingUserId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "CipherId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "CollectionId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "Date" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte? > ( "DeviceType" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "DomainName" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2025-10-01 09:13:49 -04:00
b . Property < Guid ? > ( "GrantedServiceAccountId" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "GroupId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "InstallationId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < string > ( "IpAddress" )
. HasMaxLength ( 50 )
2023-03-02 08:50:27 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "OrganizationId" )
2023-03-02 08:50:27 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "OrganizationUserId" )
2023-03-02 08:50:27 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "PolicyId" )
. HasColumnType ( "TEXT" ) ;
2023-03-02 08:50:27 -05:00
2025-08-20 10:24:17 -04:00
b . Property < Guid ? > ( "ProjectId" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "ProviderId" )
2023-03-02 08:50:27 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "ProviderOrganizationId" )
2023-03-02 08:50:27 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "ProviderUserId" )
2023-03-02 08:50:27 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "SecretId" )
2023-03-02 08:50:27 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "ServiceAccountId" )
2023-03-02 08:50:27 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < byte? > ( "SystemUser" )
. HasColumnType ( "INTEGER" ) ;
2023-03-02 08:50:27 -05:00
2023-12-13 07:03:42 -08:00
b . Property < int > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
2023-03-02 08:50:27 -05:00
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
2025-10-01 09:13:49 -04:00
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
2023-12-13 07:03:42 -08:00
2024-01-10 12:03:16 -06:00
b . HasIndex ( "Date" , "OrganizationId" , "ActingUserId" , "CipherId" )
2025-10-01 09:13:49 -04:00
. HasDatabaseName ( "IX_Event_DateOrganizationIdUserId" )
. HasAnnotation ( "SqlServer:Clustered" , false )
. HasAnnotation ( "SqlServer:Include" , new [ ] { "ServiceAccountId" , "GrantedServiceAccountId" } ) ;
2024-01-10 12:03:16 -06:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "Event" , ( string ) null ) ;
2023-03-02 08:50:27 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Group" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "ExternalId" )
. HasMaxLength ( 300 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Name" )
2024-07-04 21:14:37 -04:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 100 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "OrganizationId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "RevisionDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . HasKey ( "Id" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "OrganizationId" ) ;
b . ToTable ( "Group" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.GroupUser" , b = >
{
b . Property < Guid > ( "GroupId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "OrganizationUserId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasKey ( "GroupId" , "OrganizationUserId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "OrganizationUserId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . ToTable ( "GroupUser" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey" , b = >
{
b . Property < Guid > ( "Id" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "ApiKey" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 30 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "OrganizationId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "OrganizationId" ) ;
2023-12-13 07:03:42 -08:00
b . ToTable ( "OrganizationApiKey" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationConnection" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Config" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "Enabled" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "OrganizationId" ) ;
2023-12-13 07:03:42 -08:00
b . ToTable ( "OrganizationConnection" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationDomain" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "CreationDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "DomainName" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 255 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < int > ( "JobRunCount" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . Property < DateTime ? > ( "LastCheckedDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime > ( "NextRunDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "OrganizationId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "Txt" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime ? > ( "VerifiedDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
2023-12-13 07:03:42 -08:00
b . HasIndex ( "OrganizationId" ) ;
b . ToTable ( "OrganizationDomain" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "FriendlyName" )
. HasMaxLength ( 256 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2025-04-16 17:27:58 +02:00
b . Property < bool > ( "IsAdminInitiated" )
. HasColumnType ( "INTEGER" ) ;
2023-12-13 07:03:42 -08:00
b . Property < DateTime ? > ( "LastSyncDate" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2025-04-16 17:27:58 +02:00
b . Property < string > ( "Notes" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "OfferedToEmail" )
. HasMaxLength ( 256 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < byte? > ( "PlanSponsorshipType" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid ? > ( "SponsoredOrganizationId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid ? > ( "SponsoringOrganizationId" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "SponsoringOrganizationUserId" )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "ToDelete" )
. HasColumnType ( "INTEGER" ) ;
b . Property < DateTime ? > ( "ValidUntil" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
2023-12-13 07:03:42 -08:00
b . HasIndex ( "SponsoredOrganizationId" ) ;
2022-12-14 09:28:51 -05:00
2023-12-13 07:03:42 -08:00
b . HasIndex ( "SponsoringOrganizationId" ) ;
2022-12-14 09:28:51 -05:00
2024-01-10 12:03:16 -06:00
b . HasIndex ( "SponsoringOrganizationUserId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2023-12-13 07:03:42 -08:00
b . ToTable ( "OrganizationSponsorship" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationUser" , b = >
2022-12-14 09:28:51 -05:00
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < bool > ( "AccessSecretsManager" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Email" )
2023-12-13 07:03:42 -08:00
. HasMaxLength ( 256 )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "ExternalId" )
. HasMaxLength ( 300 )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Key" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < string > ( "Permissions" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < string > ( "ResetPasswordKey" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
2023-12-13 07:03:42 -08:00
b . Property < short > ( "Status" )
2022-12-14 09:28:51 -05:00
. HasColumnType ( "INTEGER" ) ;
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid ? > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
2024-01-10 12:03:16 -06:00
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2022-12-14 09:28:51 -05:00
2024-01-10 12:03:16 -06:00
b . HasIndex ( "UserId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2023-12-13 07:03:42 -08:00
b . ToTable ( "OrganizationUser" , ( string ) null ) ;
2022-12-14 09:28:51 -05:00
} ) ;
2026-01-13 18:10:01 +01:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.PlayItem" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "PlayId" )
. IsRequired ( )
. HasMaxLength ( 256 )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "PlayId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "UserId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "PlayItem" , null , t = >
{
t . HasCheckConstraint ( "CK_PlayItem_UserOrOrganization" , "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)" ) ;
} ) ;
} ) ;
2022-12-14 09:28:51 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Send" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < int > ( "AccessCount" )
. HasColumnType ( "INTEGER" ) ;
2025-12-31 15:37:42 -05:00
b . Property < byte? > ( "AuthType" )
. HasColumnType ( "INTEGER" ) ;
2024-03-04 19:31:33 -05:00
b . Property < Guid ? > ( "CipherId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Data" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "DeletionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "Disabled" )
. HasColumnType ( "INTEGER" ) ;
2025-05-27 08:25:27 -04:00
b . Property < string > ( "Emails" )
2025-12-31 15:37:42 -05:00
. HasMaxLength ( 4000 )
2025-05-27 08:25:27 -04:00
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < DateTime ? > ( "ExpirationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < bool? > ( "HideEmail" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "Key" )
. HasColumnType ( "TEXT" ) ;
b . Property < int? > ( "MaxAccessCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid ? > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Password" )
. HasMaxLength ( 300 )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid ? > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
2024-01-09 09:46:45 -06:00
b . HasIndex ( "DeletionDate" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2022-12-14 09:28:51 -05:00
b . HasIndex ( "OrganizationId" ) ;
2024-01-09 09:46:45 -06:00
b . HasIndex ( "UserId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "UserId" , "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2022-12-14 09:28:51 -05:00
b . ToTable ( "Send" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.TaxRate" , b = >
{
b . Property < string > ( "Id" )
. HasMaxLength ( 40 )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "Active" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "Country" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2022-12-14 09:28:51 -05:00
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "PostalCode" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2022-12-14 09:28:51 -05:00
. HasMaxLength ( 10 )
. HasColumnType ( "TEXT" ) ;
b . Property < decimal > ( "Rate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "State" )
. HasMaxLength ( 2 )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . ToTable ( "TaxRate" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Transaction" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < decimal > ( "Amount" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Details" )
. HasMaxLength ( 100 )
. HasColumnType ( "TEXT" ) ;
b . Property < byte? > ( "Gateway" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "GatewayId" )
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte? > ( "PaymentMethodType" )
. HasColumnType ( "INTEGER" ) ;
2024-03-21 11:15:49 -04:00
b . Property < Guid ? > ( "ProviderId" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < bool? > ( "Refunded" )
. HasColumnType ( "INTEGER" ) ;
b . Property < decimal? > ( "RefundedAmount" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid ? > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "OrganizationId" ) ;
2024-03-21 11:15:49 -04:00
b . HasIndex ( "ProviderId" ) ;
2024-01-10 12:03:16 -06:00
b . HasIndex ( "UserId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "UserId" , "OrganizationId" , "CreationDate" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2022-12-14 09:28:51 -05:00
b . ToTable ( "Transaction" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.User" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "AccountRevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "ApiKey" )
. IsRequired ( )
. HasMaxLength ( 30 )
. HasColumnType ( "TEXT" ) ;
2023-01-10 07:50:34 -05:00
b . Property < string > ( "AvatarColor" )
. HasMaxLength ( 7 )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Culture" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2022-12-14 09:28:51 -05:00
. HasMaxLength ( 10 )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Email" )
. IsRequired ( )
. HasMaxLength ( 256 )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "EmailVerified" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "EquivalentDomains" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "ExcludedGlobalEquivalentDomains" )
. HasColumnType ( "TEXT" ) ;
b . Property < int > ( "FailedLoginCount" )
. HasColumnType ( "INTEGER" ) ;
b . Property < bool > ( "ForcePasswordReset" )
. HasColumnType ( "INTEGER" ) ;
b . Property < byte? > ( "Gateway" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "GatewayCustomerId" )
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "GatewaySubscriptionId" )
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Kdf" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int > ( "KdfIterations" )
. HasColumnType ( "INTEGER" ) ;
2023-01-25 13:56:54 +01:00
b . Property < int? > ( "KdfMemory" )
. HasColumnType ( "INTEGER" ) ;
b . Property < int? > ( "KdfParallelism" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
b . Property < string > ( "Key" )
. HasColumnType ( "TEXT" ) ;
2023-02-02 14:39:57 -05:00
b . Property < DateTime ? > ( "LastEmailChangeDate" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < DateTime ? > ( "LastFailedLoginDate" )
. HasColumnType ( "TEXT" ) ;
2023-02-02 14:39:57 -05:00
b . Property < DateTime ? > ( "LastKdfChangeDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "LastKeyRotationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "LastPasswordChangeDate" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < string > ( "LicenseKey" )
. HasMaxLength ( 100 )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "MasterPassword" )
. HasMaxLength ( 300 )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "MasterPasswordHint" )
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
b . Property < short? > ( "MaxStorageGb" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "Name" )
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "Premium" )
. HasColumnType ( "INTEGER" ) ;
b . Property < DateTime ? > ( "PremiumExpirationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "PrivateKey" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "PublicKey" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "ReferenceData" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "RenewalReminderDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "SecurityStamp" )
. IsRequired ( )
. HasMaxLength ( 50 )
. HasColumnType ( "TEXT" ) ;
[PM-21034] Feature Branch - "User Crypto V2" (#5982)
* [PM-21034] Database changes for signature keypairs (#5906)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Drop view if exists
* Enable nullable
* Replace with create or alter view
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* [PM-21034] Implement api changes to retreive signing keys (#5932)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* [PM-22384] Implement key-rotation based enrollment to user-crypto v2 (#5934)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Cleanup
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Fix build
* [PM-22862] Account security version (#5995)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Merge branch 'km/signing-upgrade-rotation' into km/account-security-version
* Add security state to rotation
* Update tests
* Update tests and check for security state in v2 model
* Cleanup
* Add tests
* Add security state data to integration test
* Re-sort and remove limit
* Update migrations
* Fix sql
* Fix sql
* Fix sql
* Fix fixture
* Fix test
* Fix test
* Fix test
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* [PM-22853] Add feature flag (#6090)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Merge branch 'km/signing-upgrade-rotation' into km/account-security-version
* Add security state to rotation
* Update tests
* Add feature flag
* Update tests and check for security state in v2 model
* Cleanup
* Add tests
* Add security state data to integration test
* Re-sort and remove limit
* Update migrations
* Fix sql
* Fix sql
* Fix sql
* Fix fixture
* Fix test
* Fix test
* Fix test
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* [PM-23222] Update revision date on key rotation (#6038)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Merge branch 'km/signing-upgrade-rotation' into km/account-security-version
* Add security state to rotation
* Update tests
* Update revision date on key rotation
* Update tests and check for security state in v2 model
* Cleanup
* Add tests
* Add security state data to integration test
* Re-sort and remove limit
* Update migrations
* Fix sql
* Fix sql
* Fix sql
* Fix fixture
* Fix test
* Fix test
* Fix test
* Add test for change date
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Fix signing keys
* Update sql migrations
* Fix tests
* Add keys to identity token response
* Fix tests
* Fix tests
* Fix formatting
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Infrastructure.Dapper/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Requests/SignatureKeyPairRequestModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Requests/PublicKeyEncryptionKeyPairRequestModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Entities/UserSignatureKeyPair.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Repositories/IUserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Queries/UserAccountKeysQuery.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/PublicKeyEncryptionKeyPairData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Entities/UserSignatureKeyPair.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/RotateUserAccountKeysData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/SignatureKeyPairData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/SecurityStateData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/UserAccountKeysData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Request/SecurityStateModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/PublicKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/PublicKeyEncryptionKeyPairResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Queries/Interfaces/IUserAcountKeysQuery.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/SignatureKeyPairResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove unnecessary file
* Add eof spacing
* Move models
* Fix build
* Move models to API subdirectory
* Rename model
* Remove migrations
* Add new ef migrations
* Remove empty line
* Only query account keys if the user has keys
* Dotnet format
* Fix test
* Update test/Identity.Test/IdentityServer/BaseRequestValidatorTests.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Apply suggestion
* Fix whitespace
* Force camel case on response models
* Address feedback for sql files
* Fix build
* Make index unique
* Add contstraints
* Fix sql
* Fix order
* Cleanup
* Fix build
* Update migrations
* Update EF migrations
* Change parameters to nvarchar
* Update to Varchar
* Apply feedback
* Move refresh view
* Attempt to fix build
* Undo sql changes
* Apply feedback about varchar
* Apply feedback about refresh view
* Apply feedback about new lines
* Address SQL feedback
* Re-sort columns
* Fix build
* Fix order
* Fix build
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
2025-10-20 12:51:08 +02:00
b . Property < string > ( "SecurityState" )
. HasColumnType ( "TEXT" ) ;
b . Property < int? > ( "SecurityVersion" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "SignedPublicKey" )
. HasColumnType ( "TEXT" ) ;
2022-12-14 09:28:51 -05:00
b . Property < long? > ( "Storage" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "TwoFactorProviders" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "TwoFactorRecoveryCode" )
. HasMaxLength ( 32 )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "UsesKeyConnector" )
. HasColumnType ( "INTEGER" ) ;
2025-01-08 07:31:24 -08:00
b . Property < bool > ( "VerifyDevices" )
. HasColumnType ( "INTEGER" ) ;
2022-12-14 09:28:51 -05:00
b . HasKey ( "Id" ) ;
2024-01-10 12:03:16 -06:00
b . HasIndex ( "Email" )
. IsUnique ( )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "Premium" , "PremiumExpirationDate" , "RenewalReminderDate" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2022-12-14 09:28:51 -05:00
b . ToTable ( "User" , ( string ) null ) ;
} ) ;
[PM-21034] Feature Branch - "User Crypto V2" (#5982)
* [PM-21034] Database changes for signature keypairs (#5906)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Drop view if exists
* Enable nullable
* Replace with create or alter view
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* [PM-21034] Implement api changes to retreive signing keys (#5932)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* [PM-22384] Implement key-rotation based enrollment to user-crypto v2 (#5934)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Cleanup
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Fix build
* [PM-22862] Account security version (#5995)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Merge branch 'km/signing-upgrade-rotation' into km/account-security-version
* Add security state to rotation
* Update tests
* Update tests and check for security state in v2 model
* Cleanup
* Add tests
* Add security state data to integration test
* Re-sort and remove limit
* Update migrations
* Fix sql
* Fix sql
* Fix sql
* Fix fixture
* Fix test
* Fix test
* Fix test
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* [PM-22853] Add feature flag (#6090)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Merge branch 'km/signing-upgrade-rotation' into km/account-security-version
* Add security state to rotation
* Update tests
* Add feature flag
* Update tests and check for security state in v2 model
* Cleanup
* Add tests
* Add security state data to integration test
* Re-sort and remove limit
* Update migrations
* Fix sql
* Fix sql
* Fix sql
* Fix fixture
* Fix test
* Fix test
* Fix test
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* [PM-23222] Update revision date on key rotation (#6038)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Merge branch 'km/signing-upgrade-rotation' into km/account-security-version
* Add security state to rotation
* Update tests
* Update revision date on key rotation
* Update tests and check for security state in v2 model
* Cleanup
* Add tests
* Add security state data to integration test
* Re-sort and remove limit
* Update migrations
* Fix sql
* Fix sql
* Fix sql
* Fix fixture
* Fix test
* Fix test
* Fix test
* Add test for change date
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Fix signing keys
* Update sql migrations
* Fix tests
* Add keys to identity token response
* Fix tests
* Fix tests
* Fix formatting
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Infrastructure.Dapper/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Requests/SignatureKeyPairRequestModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Requests/PublicKeyEncryptionKeyPairRequestModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Entities/UserSignatureKeyPair.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Repositories/IUserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Queries/UserAccountKeysQuery.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/PublicKeyEncryptionKeyPairData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Entities/UserSignatureKeyPair.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/RotateUserAccountKeysData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/SignatureKeyPairData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/SecurityStateData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/UserAccountKeysData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Request/SecurityStateModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/PublicKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/PublicKeyEncryptionKeyPairResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Queries/Interfaces/IUserAcountKeysQuery.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/SignatureKeyPairResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove unnecessary file
* Add eof spacing
* Move models
* Fix build
* Move models to API subdirectory
* Rename model
* Remove migrations
* Add new ef migrations
* Remove empty line
* Only query account keys if the user has keys
* Dotnet format
* Fix test
* Update test/Identity.Test/IdentityServer/BaseRequestValidatorTests.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Apply suggestion
* Fix whitespace
* Force camel case on response models
* Address feedback for sql files
* Fix build
* Make index unique
* Add contstraints
* Fix sql
* Fix order
* Cleanup
* Fix build
* Update migrations
* Update EF migrations
* Change parameters to nvarchar
* Update to Varchar
* Apply feedback
* Move refresh view
* Attempt to fix build
* Undo sql changes
* Apply feedback about varchar
* Apply feedback about refresh view
* Apply feedback about new lines
* Address SQL feedback
* Re-sort columns
* Fix build
* Fix order
* Fix build
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
2025-10-20 12:51:08 +02:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.UserSignatureKeyPair" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "SignatureAlgorithm" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "SigningKey" )
. IsRequired ( )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "VerifyingKey" )
. IsRequired ( )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "UserId" )
. IsUnique ( )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "UserSignatureKeyPair" , ( string ) null ) ;
} ) ;
2024-09-09 14:52:12 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.NotificationCenter.Models.Notification" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Body" )
2025-02-13 14:14:55 +01:00
. HasMaxLength ( 3000 )
2024-09-09 14:52:12 -05:00
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "ClientType" )
. HasColumnType ( "INTEGER" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "Global" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid ? > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Priority" )
. HasColumnType ( "INTEGER" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
2025-02-10 11:39:48 -05:00
b . Property < Guid ? > ( "TaskId" )
. HasColumnType ( "TEXT" ) ;
2024-09-09 14:52:12 -05:00
b . Property < string > ( "Title" )
. HasMaxLength ( 256 )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2025-02-10 11:39:48 -05:00
b . HasIndex ( "TaskId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
2024-09-09 14:52:12 -05:00
b . HasIndex ( "UserId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "ClientType" , "Global" , "UserId" , "OrganizationId" , "Priority" , "CreationDate" )
. IsDescending ( false , false , false , false , true , true )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "Notification" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.NotificationCenter.Models.NotificationStatus" , b = >
{
b . Property < Guid > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "NotificationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "DeletedDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "ReadDate" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "UserId" , "NotificationId" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "NotificationId" ) ;
b . ToTable ( "NotificationStatus" , ( string ) null ) ;
} ) ;
2025-01-16 14:35:00 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Platform.Installation" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Email" )
. IsRequired ( )
. HasMaxLength ( 256 )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "Enabled" )
. HasColumnType ( "INTEGER" ) ;
b . Property < string > ( "Key" )
. IsRequired ( )
. HasMaxLength ( 150 )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "LastActivityDate" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . ToTable ( "Installation" , ( string ) null ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Discriminator" )
. IsRequired ( )
2024-07-02 10:08:34 -04:00
. HasMaxLength ( 34 )
2023-02-01 12:27:13 -06:00
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "Read" )
. HasColumnType ( "INTEGER" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < bool > ( "Write" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . ToTable ( "AccessPolicy" , ( string ) null ) ;
2024-07-24 09:48:09 -04:00
b . HasDiscriminator ( ) . HasValue ( "AccessPolicy" ) ;
2023-07-26 15:55:28 -04:00
b . UseTphMappingStrategy ( ) ;
2023-02-01 12:27:13 -06:00
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ApiKey" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2023-06-21 13:16:06 -05:00
b . Property < string > ( "ClientSecretHash" )
. HasMaxLength ( 128 )
2023-02-01 12:27:13 -06:00
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "EncryptedPayload" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2023-02-01 12:27:13 -06:00
. HasMaxLength ( 4000 )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "ExpireAt" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Key" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2023-02-01 12:27:13 -06:00
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Name" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2023-02-01 12:27:13 -06:00
. HasMaxLength ( 200 )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Scope" )
2024-07-03 16:21:25 -04:00
. IsRequired ( )
2023-02-01 12:27:13 -06:00
. HasMaxLength ( 4000 )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "ServiceAccountId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "ServiceAccountId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "ApiKey" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Project" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "DeletedDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Name" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "DeletedDate" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "Project" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Secret" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "DeletedDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Key" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Note" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Value" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "DeletedDate" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "Secret" , ( string ) null ) ;
} ) ;
2025-10-16 15:35:14 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.SecretVersion" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "EditorOrganizationUserId" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "EditorServiceAccountId" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "SecretId" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Value" )
. IsRequired ( )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "VersionDate" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "EditorOrganizationUserId" )
. HasDatabaseName ( "IX_SecretVersion_EditorOrganizationUserId" ) ;
b . HasIndex ( "EditorServiceAccountId" )
. HasDatabaseName ( "IX_SecretVersion_EditorServiceAccountId" ) ;
b . HasIndex ( "SecretId" )
. HasDatabaseName ( "IX_SecretVersion_SecretId" ) ;
b . ToTable ( "SecretVersion" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Name" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "ServiceAccount" , ( string ) null ) ;
} ) ;
2023-03-23 13:08:49 +00:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Vault.Models.Cipher" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
2026-01-07 09:29:10 -08:00
b . Property < string > ( "Archives" )
2025-09-12 13:24:30 -04:00
. HasColumnType ( "TEXT" ) ;
2023-03-23 13:08:49 +00:00
b . Property < string > ( "Attachments" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Data" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime ? > ( "DeletedDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Favorites" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Folders" )
. HasColumnType ( "TEXT" ) ;
[AC-1122] Add AllowAdminAccessToAllCollectionItems setting to Organizations (#3379)
* [AC-1117] Add manage permission (#3126)
* Update sql files to add Manage permission
* Add migration script
* Rename collection manage migration file to remove duplicate migration date
* Migrations
* Add manage to models
* Add manage to repository
* Add constraint to Manage columns
* Migration lint fixes
* Add manage to OrganizationUserUserDetails_ReadWithCollectionsById
* Add missing manage fields
* Add 'Manage' to UserCollectionDetails
* Use CREATE OR ALTER where possible
* [AC-1374] Limit collection creation/deletion to Owner/Admin (#3145)
* feat: update org table with new column, write migration, refs AC-1374
* feat: update views with new column, refs AC-1374
* feat: Alter sprocs (org create/update) to include new column, refs AC-1374
* feat: update entity/data/request/response models to handle new column, refs AC-1374
* feat: update necessary Provider related views during migration, refs AC-1374
* fix: update org create to default new column to false, refs AC-1374
* feat: added new API/request model for collection management and removed property from update request model, refs AC-1374
* fix: renamed migration script to be after secrets manage beta column changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: add ef migrations to reflect mssql changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: update API signature to accept Guid and explain Cd verbiage, refs AC-1374
* fix: merge conflict resolution
* [AC-1174] CollectionUser and CollectionGroup authorization handlers (#3194)
* [AC-1174] Introduce BulkAuthorizationHandler.cs
* [AC-1174] Introduce CollectionUserAuthorizationHandler
* [AC-1174] Add CreateForNewCollection CollectionUser requirement
* [AC-1174] Add some more details to CollectionCustomization
* [AC-1174] Formatting
* [AC-1174] Add CollectionGroupOperation.cs
* [AC-1174] Introduce CollectionGroupAuthorizationHandler.cs
* [AC-1174] Cleanup CollectionFixture customization
Implement and use re-usable extension method to support seeded Guids
* [AC-1174] Introduce WithValueFromList AutoFixtureExtensions
Modify CollectionCustomization to use multiple organization Ids for auto generated test data
* [AC-1174] Simplify CollectionUserAuthorizationHandler.cs
Modify the authorization handler to only perform authorization logic. Validation logic will need to be handled by any calling commands/controllers instead.
* [AC-1174] Introduce shared CollectionAccessAuthorizationHandlerBase
A shared base authorization handler was created for both CollectionUser and CollectionGroup resources, as they share the same underlying management authorization logic.
* [AC-1174] Update CollectionUserAuthorizationHandler and CollectionGroupAuthorizationHandler to use the new CollectionAccessAuthorizationHandlerBase class
* [AC-1174] Formatting
* [AC-1174] Cleanup typo and redundant ToList() call
* [AC-1174] Add check for provider users
* [AC-1174] Reduce nested loops
* [AC-1174] Introduce ICollectionAccess.cs
* [AC-1174] Remove individual CollectionGroup and CollectionUser auth handlers and use base class instead
* [AC-1174] Tweak unit test to fail minimally
* [AC-1174] Reorganize authorization handlers in Core project
* [AC-1174] Introduce new AddCoreAuthorizationHandlers() extension method
* [AC-1174] Move CollectionAccessAuthorizationHandler into Api project
* [AC-1174] Move CollectionFixture to Vault folder
* [AC-1174] Rename operation to CreateUpdateDelete
* [AC-1174] Require single organization for collection access authorization handler
- Add requirement that all target collections must belong to the same organization
- Simplify logic related to multiple organizations
- Update tests and helpers
- Use ToHashSet to improve lookup time
* [AC-1174] Fix null reference exception
* [AC-1174] Throw bad request exception when collections belong to different organizations
* [AC-1174] Switch to CollectionAuthorizationHandler instead of CollectionAccessAuthorizationHandler to reduce complexity
* Fix improper merge conflict resolution
* fix: add permission check for collection management api, refs AC-1647 (#3252)
* [AC-1125] Enforce org setting for creating/deleting collections (#3241)
* [AC-1117] Add manage permission (#3126)
* Update sql files to add Manage permission
* Add migration script
* Rename collection manage migration file to remove duplicate migration date
* Migrations
* Add manage to models
* Add manage to repository
* Add constraint to Manage columns
* Migration lint fixes
* Add manage to OrganizationUserUserDetails_ReadWithCollectionsById
* Add missing manage fields
* Add 'Manage' to UserCollectionDetails
* Use CREATE OR ALTER where possible
* [AC-1374] Limit collection creation/deletion to Owner/Admin (#3145)
* feat: update org table with new column, write migration, refs AC-1374
* feat: update views with new column, refs AC-1374
* feat: Alter sprocs (org create/update) to include new column, refs AC-1374
* feat: update entity/data/request/response models to handle new column, refs AC-1374
* feat: update necessary Provider related views during migration, refs AC-1374
* fix: update org create to default new column to false, refs AC-1374
* feat: added new API/request model for collection management and removed property from update request model, refs AC-1374
* fix: renamed migration script to be after secrets manage beta column changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: add ef migrations to reflect mssql changes, refs AC-1374
* fix: dotnet format, refs AC-1374
* feat: update API signature to accept Guid and explain Cd verbiage, refs AC-1374
* feat: created collection auth handler/operations, added LimitCollectionCdOwnerAdmin to CurrentContentOrganization, refs AC-1125
* feat: create vault service collection extensions and register with base services, refs AC-1125
* feat: deprecated CurrentContext.CreateNewCollections, refs AC-1125
* feat: deprecate DeleteAnyCollection for single resource usages, refs AC-1125
* feat: move service registration to api, update references, refs AC-1125
* feat: add bulk delete authorization handler, refs AC-1125
* feat: always assign user and give manage access on create, refs AC-1125
* fix: updated CurrentContextOrganization type, refs AC-1125
* feat: combined existing collection authorization handlers/operations, refs AC-1125
* fix: OrganizationServiceTests -> CurrentContentOrganization typo, refs AC-1125
* fix: format, refs AC-1125
* fix: update collection controller tests, refs AC-1125
* fix: dotnet format, refs AC-1125
* feat: removed extra BulkAuthorizationHandler, refs AC-1125
* fix: dotnet format, refs AC-1125
* fix: change string to guid for org id, update bulk delete request model, refs AC-1125
* fix: remove delete many collection check, refs AC-1125
* fix: clean up collection auth handler, refs AC-1125
* fix: format fix for CollectionOperations, refs AC-1125
* fix: removed unnecessary owner check, add org null check to custom permission validation, refs AC-1125
* fix: remove unused methods in CurrentContext, refs AC-1125
* fix: removed obsolete test, fixed failling delete many test, refs AC-1125
* fix: CollectionAuthorizationHandlerTests fixes, refs AC-1125
* fix: OrganizationServiceTests fix broken test by mocking GetOrganization, refs AC-1125
* fix: CollectionAuthorizationHandler - remove unused repository, refs AC-1125
* feat: moved UserId null check to common method, refs AC-1125
* fix: updated auth handler tests to remove dependency on requirement for common code checks, refs AC-1125
* feat: updated conditionals/comments for create/delete methods within colleciton auth handler, refs AC-1125
* feat: added create/delete collection auth handler success methods, refs AC-1125
* fix: new up permissions to prevent excessive null checks, refs AC-1125
* fix: remove old reference to CreateNewCollections, refs AC-1125
* fix: typo within ViewAssignedCollections method, refs AC-1125
---------
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
* refactor: remove organizationId from CollectionBulkDeleteRequestModel, refs AC-1649 (#3282)
* [AC-1174] Bulk Collection Management (#3229)
* [AC-1174] Update SelectionReadOnlyRequestModel to use Guid for Id property
* [AC-1174] Introduce initial bulk-access collection endpoint
* [AC-1174] Introduce BulkAddCollectionAccessCommand and validation logic/tests
* [AC-1174] Add CreateOrUpdateAccessMany method to CollectionRepository
* [AC-1174] Add event logs for bulk add collection access command
* [AC-1174] Add User_BumpAccountRevisionDateByCollectionIds and database migration script
* [AC-1174] Implement EF repository method
* [AC-1174] Improve null checks
* [AC-1174] Remove unnecessary BulkCollectionAccessRequestModel helpers
* [AC-1174] Add unit tests for new controller endpoint
* [AC-1174] Fix formatting
* [AC-1174] Remove comment
* [AC-1174] Remove redundant organizationId parameter
* [AC-1174] Ensure user and group Ids are distinct
* [AC-1174] Cleanup tests based on PR feedback
* [AC-1174] Formatting
* [AC-1174] Update CollectionGroup alias in the sproc
* [AC-1174] Add some additional comments to SQL sproc
* [AC-1174] Add comment explaining additional SaveChangesAsync call
---------
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* [AC-1646] Rename LimitCollectionCdOwnerAdmin column (#3300)
* Rename LimitCollectionCdOwnerAdmin -> LimitCollectionCreationDeletion
* Rename and bump migration script
* [AC-1666] Removed EditAnyCollection from Create/Delete permission checks (#3301)
* fix: remove EditAnyCollection from Create/Delete permission check, refs AC-1666
* fix: updated comment, refs AC-1666
* [AC-1669] Bug - Remove obsolete assignUserId from CollectionService.SaveAsync(...) (#3312)
* fix: remove AssignUserId from CollectionService.SaveAsync, refs AC-1669
* fix: add manage access conditional before creating collection, refs AC-1669
* fix: move access logic for create/update, fix all tests, refs AC-1669
* fix: add CollectionAccessSelection fixture, update tests, update bad reqeuest message, refs AC-1669
* fix: format, refs AC-1669
* fix: update null params with specific arg.is null checks, refs Ac-1669
* fix: update attribute class name, refs AC-1669
* [AC-1713] [Flexible collections] Add feature flags to server (#3334)
* Add feature flags for FlexibleCollections and BulkCollectionAccess
* Flag new routes and behaviour
---------
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
* Add joint codeownership for auth handlers (#3346)
* [AC-1717] Update default values for LimitCollectionCreationDeletion (#3365)
* Change default value in organization create sproc to 1
* Drop old column name still present in some QA instances
* Set LimitCollectionCreationDeletion value in code based on feature flag
* Fix: add missing namespace after merging in master
* Fix: add missing namespace after merging in master
* [AC-1683] Fix DB migrations for new Manage permission (#3307)
* [AC-1683] Update migration script and introduce V2 procedures and types
* [AC-1683] Update repository calls to use new V2 procedures / types
* [AC-1684] Update bulk add collection migration script to use new V2 type
* [AC-1683] Undo Manage changes to more original procedures
* [AC-1683] Restore whitespace changes
* [AC-1683] Clarify comments regarding explicit column lists
* [AC-1683] Update migration script dates
* [AC-1683] Split the migration script for readability
* [AC-1683] Re-name SelectReadOnlyArray_V2 to CollectionAccessSelectionType
* [AC-1648] [Flexible Collections] Bump migration scripts before feature branch merge (#3371)
* Bump dates on sql migration scripts
* Bump date on ef migrations
* [AC-1727] Add AllowAdminAccessToAllCollectionItems column to Organization table
* [AC-1720] Update stored procedures and views that query the organization table and new column
* [AC-1727] Add EF migrations for new DB column
* [AC-1729] Update API request/response models
* [AC-1122] Add new setting to CurrentContextOrganization.cs
* [AC-1122] Ensure new setting is disabled for new orgs when the feature flag is enabled
* [AC-1122] Use V1 feature flag for new setting
* [AC-1122] Formatting
* [AC-1122] Update migration script date
---------
Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
2023-11-27 11:44:07 -08:00
2023-09-28 08:45:13 -04:00
b . Property < string > ( "Key" )
. HasColumnType ( "TEXT" ) ;
2023-03-23 13:08:49 +00:00
b . Property < Guid ? > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte? > ( "Reprompt" )
. HasColumnType ( "INTEGER" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
b . Property < Guid ? > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "OrganizationId" ) ;
b . HasIndex ( "UserId" ) ;
b . ToTable ( "Cipher" , ( string ) null ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Vault.Models.Folder" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < string > ( "Name" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "UserId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "Id" ) ;
b . HasIndex ( "UserId" ) ;
b . ToTable ( "Folder" , ( string ) null ) ;
} ) ;
2024-11-14 14:54:20 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Vault.Models.SecurityTask" , b = >
{
b . Property < Guid > ( "Id" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid ? > ( "CipherId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "CreationDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "OrganizationId" )
. HasColumnType ( "TEXT" ) ;
b . Property < DateTime > ( "RevisionDate" )
. HasColumnType ( "TEXT" ) ;
b . Property < byte > ( "Status" )
. HasColumnType ( "INTEGER" ) ;
b . Property < byte > ( "Type" )
. HasColumnType ( "INTEGER" ) ;
b . HasKey ( "Id" )
. HasAnnotation ( "SqlServer:Clustered" , true ) ;
b . HasIndex ( "CipherId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . HasIndex ( "OrganizationId" )
. HasAnnotation ( "SqlServer:Clustered" , false ) ;
b . ToTable ( "SecurityTask" , ( string ) null ) ;
} ) ;
2023-01-13 15:02:53 +01:00
modelBuilder . Entity ( "ProjectSecret" , b = >
{
b . Property < Guid > ( "ProjectsId" )
. HasColumnType ( "TEXT" ) ;
b . Property < Guid > ( "SecretsId" )
. HasColumnType ( "TEXT" ) ;
b . HasKey ( "ProjectsId" , "SecretsId" ) ;
b . HasIndex ( "SecretsId" ) ;
b . ToTable ( "ProjectSecret" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.GroupProjectAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasBaseType ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy" ) ;
2023-01-13 15:02:53 +01:00
b . Property < Guid ? > ( "GrantedProjectId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GrantedProjectId" ) ;
b . Property < Guid ? > ( "GroupId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GroupId" ) ;
b . HasIndex ( "GrantedProjectId" ) ;
b . HasIndex ( "GroupId" ) ;
b . HasDiscriminator ( ) . HasValue ( "group_project" ) ;
} ) ;
2024-02-22 10:06:39 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.GroupSecretAccessPolicy" , b = >
{
b . HasBaseType ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy" ) ;
b . Property < Guid ? > ( "GrantedSecretId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GrantedSecretId" ) ;
b . Property < Guid ? > ( "GroupId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GroupId" ) ;
b . HasIndex ( "GrantedSecretId" ) ;
b . HasIndex ( "GroupId" ) ;
b . HasDiscriminator ( ) . HasValue ( "group_secret" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.GroupServiceAccountAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasBaseType ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy" ) ;
2023-01-13 15:02:53 +01:00
b . Property < Guid ? > ( "GrantedServiceAccountId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GrantedServiceAccountId" ) ;
b . Property < Guid ? > ( "GroupId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GroupId" ) ;
b . HasIndex ( "GrantedServiceAccountId" ) ;
b . HasIndex ( "GroupId" ) ;
b . HasDiscriminator ( ) . HasValue ( "group_service_account" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccountProjectAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasBaseType ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy" ) ;
2023-01-13 15:02:53 +01:00
b . Property < Guid ? > ( "GrantedProjectId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GrantedProjectId" ) ;
b . Property < Guid ? > ( "ServiceAccountId" )
2024-02-22 10:06:39 -06:00
. ValueGeneratedOnUpdateSometimes ( )
2023-01-13 15:02:53 +01:00
. HasColumnType ( "TEXT" )
. HasColumnName ( "ServiceAccountId" ) ;
b . HasIndex ( "GrantedProjectId" ) ;
b . HasIndex ( "ServiceAccountId" ) ;
b . HasDiscriminator ( ) . HasValue ( "service_account_project" ) ;
} ) ;
2024-02-22 10:06:39 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccountSecretAccessPolicy" , b = >
{
b . HasBaseType ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy" ) ;
b . Property < Guid ? > ( "GrantedSecretId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GrantedSecretId" ) ;
b . Property < Guid ? > ( "ServiceAccountId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "ServiceAccountId" ) ;
b . HasIndex ( "GrantedSecretId" ) ;
b . HasIndex ( "ServiceAccountId" ) ;
b . HasDiscriminator ( ) . HasValue ( "service_account_secret" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.UserProjectAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasBaseType ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy" ) ;
2023-01-13 15:02:53 +01:00
b . Property < Guid ? > ( "GrantedProjectId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GrantedProjectId" ) ;
b . Property < Guid ? > ( "OrganizationUserId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "OrganizationUserId" ) ;
b . HasIndex ( "GrantedProjectId" ) ;
b . HasIndex ( "OrganizationUserId" ) ;
b . HasDiscriminator ( ) . HasValue ( "user_project" ) ;
} ) ;
2024-02-22 10:06:39 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.UserSecretAccessPolicy" , b = >
{
b . HasBaseType ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy" ) ;
b . Property < Guid ? > ( "GrantedSecretId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GrantedSecretId" ) ;
b . Property < Guid ? > ( "OrganizationUserId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "OrganizationUserId" ) ;
b . HasIndex ( "GrantedSecretId" ) ;
b . HasIndex ( "OrganizationUserId" ) ;
b . HasDiscriminator ( ) . HasValue ( "user_secret" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.UserServiceAccountAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasBaseType ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.AccessPolicy" ) ;
2023-01-13 15:02:53 +01:00
b . Property < Guid ? > ( "GrantedServiceAccountId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "GrantedServiceAccountId" ) ;
b . Property < Guid ? > ( "OrganizationUserId" )
. ValueGeneratedOnUpdateSometimes ( )
. HasColumnType ( "TEXT" )
. HasColumnName ( "OrganizationUserId" ) ;
b . HasIndex ( "GrantedServiceAccountId" ) ;
b . HasIndex ( "OrganizationUserId" ) ;
b . HasDiscriminator ( ) . HasValue ( "user_service_account" ) ;
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Policy" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( "Policies" )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.ProviderOrganization" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.Provider" , "Provider" )
. WithMany ( )
. HasForeignKey ( "ProviderId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
b . Navigation ( "Provider" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.ProviderUser" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.Provider" , "Provider" )
. WithMany ( )
. HasForeignKey ( "ProviderId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( )
. HasForeignKey ( "UserId" ) ;
b . Navigation ( "Provider" ) ;
b . Navigation ( "User" ) ;
} ) ;
2023-05-01 09:32:06 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.AuthRequest" , b = >
2022-12-14 09:28:51 -05:00
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2023-06-15 14:54:08 -07:00
. WithMany ( )
. HasForeignKey ( "OrganizationId" ) ;
2022-12-14 09:28:51 -05:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.Device" , "ResponseDevice" )
. WithMany ( )
. HasForeignKey ( "ResponseDeviceId" ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( )
. HasForeignKey ( "UserId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
2023-06-15 14:54:08 -07:00
b . Navigation ( "Organization" ) ;
2022-12-14 09:28:51 -05:00
b . Navigation ( "ResponseDevice" ) ;
b . Navigation ( "User" ) ;
} ) ;
2023-05-01 09:32:06 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.EmergencyAccess" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "Grantee" )
. WithMany ( )
. HasForeignKey ( "GranteeId" ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "Grantor" )
. WithMany ( )
. HasForeignKey ( "GrantorId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Grantee" ) ;
b . Navigation ( "Grantor" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.SsoConfig" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2023-05-01 09:32:06 -04:00
. WithMany ( "SsoConfigs" )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.SsoUser" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2023-05-01 09:32:06 -04:00
. WithMany ( "SsoUsers" )
. HasForeignKey ( "OrganizationId" ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( "SsoUsers" )
. HasForeignKey ( "UserId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
b . Navigation ( "User" ) ;
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Auth.Models.WebAuthnCredential" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( )
. HasForeignKey ( "UserId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "User" ) ;
} ) ;
2024-12-11 13:55:00 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Billing.Models.OrganizationInstallation" , b = >
{
2025-01-16 14:35:00 -05:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.Platform.Installation" , "Installation" )
2024-12-11 13:55:00 -05:00
. WithMany ( )
. HasForeignKey ( "InstallationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Installation" ) ;
b . Navigation ( "Organization" ) ;
} ) ;
2024-06-06 13:25:13 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Billing.Models.ProviderInvoiceItem" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.Provider" , "Provider" )
. WithMany ( )
. HasForeignKey ( "ProviderId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Provider" ) ;
} ) ;
2024-03-21 11:15:49 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Billing.Models.ProviderPlan" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.Provider" , "Provider" )
. WithMany ( )
. HasForeignKey ( "ProviderId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Provider" ) ;
} ) ;
2025-06-23 12:12:04 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationApplication" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
2026-01-13 18:10:01 +01:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationIntegration" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationIntegrationConfiguration" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationIntegration" , "OrganizationIntegration" )
. WithMany ( )
. HasForeignKey ( "OrganizationIntegrationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "OrganizationIntegration" ) ;
} ) ;
2025-06-23 12:12:04 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationReport" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
2025-06-16 17:32:36 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
2022-12-14 09:28:51 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Collection" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2023-03-02 08:50:27 -05:00
. WithMany ( "Collections" )
2022-12-14 09:28:51 -05:00
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.CollectionCipher" , b = >
{
2023-03-23 13:08:49 +00:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.Vault.Models.Cipher" , "Cipher" )
2022-12-14 09:28:51 -05:00
. WithMany ( "CollectionCiphers" )
. HasForeignKey ( "CipherId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.Collection" , "Collection" )
. WithMany ( "CollectionCiphers" )
. HasForeignKey ( "CollectionId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Cipher" ) ;
b . Navigation ( "Collection" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.CollectionGroup" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.Collection" , "Collection" )
. WithMany ( "CollectionGroups" )
. HasForeignKey ( "CollectionId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.Group" , "Group" )
. WithMany ( )
. HasForeignKey ( "GroupId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Collection" ) ;
b . Navigation ( "Group" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.CollectionUser" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.Collection" , "Collection" )
. WithMany ( "CollectionUsers" )
. HasForeignKey ( "CollectionId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.OrganizationUser" , "OrganizationUser" )
. WithMany ( "CollectionUsers" )
. HasForeignKey ( "OrganizationUserId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Collection" ) ;
b . Navigation ( "OrganizationUser" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Device" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( )
. HasForeignKey ( "UserId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "User" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Group" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2022-12-14 09:28:51 -05:00
. WithMany ( "Groups" )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.GroupUser" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.Group" , "Group" )
. WithMany ( "GroupUsers" )
. HasForeignKey ( "GroupId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.OrganizationUser" , "OrganizationUser" )
2023-01-13 14:24:58 -05:00
. WithMany ( "GroupUsers" )
2022-12-14 09:28:51 -05:00
. HasForeignKey ( "OrganizationUserId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Group" ) ;
b . Navigation ( "OrganizationUser" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2022-12-14 09:28:51 -05:00
. WithMany ( "ApiKeys" )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationConnection" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2022-12-14 09:28:51 -05:00
. WithMany ( "Connections" )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
2023-03-02 08:50:27 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationDomain" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2023-03-02 08:50:27 -05:00
. WithMany ( "Domains" )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
2022-12-14 09:28:51 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "SponsoredOrganization" )
2022-12-14 09:28:51 -05:00
. WithMany ( )
. HasForeignKey ( "SponsoredOrganizationId" ) ;
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "SponsoringOrganization" )
2022-12-14 09:28:51 -05:00
. WithMany ( )
. HasForeignKey ( "SponsoringOrganizationId" ) ;
b . Navigation ( "SponsoredOrganization" ) ;
b . Navigation ( "SponsoringOrganization" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationUser" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2022-12-14 09:28:51 -05:00
. WithMany ( "OrganizationUsers" )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( "OrganizationUsers" )
. HasForeignKey ( "UserId" ) ;
b . Navigation ( "Organization" ) ;
b . Navigation ( "User" ) ;
} ) ;
2026-01-13 18:10:01 +01:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.PlayItem" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( )
. HasForeignKey ( "UserId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
b . Navigation ( "Organization" ) ;
b . Navigation ( "User" ) ;
} ) ;
2022-12-14 09:28:51 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Send" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2022-12-14 09:28:51 -05:00
. WithMany ( )
. HasForeignKey ( "OrganizationId" ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( )
. HasForeignKey ( "UserId" ) ;
b . Navigation ( "Organization" ) ;
b . Navigation ( "User" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Transaction" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2022-12-14 09:28:51 -05:00
. WithMany ( "Transactions" )
. HasForeignKey ( "OrganizationId" ) ;
2024-03-21 11:15:49 -04:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.Provider" , "Provider" )
. WithMany ( )
. HasForeignKey ( "ProviderId" ) ;
2022-12-14 09:28:51 -05:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( "Transactions" )
. HasForeignKey ( "UserId" ) ;
b . Navigation ( "Organization" ) ;
2024-03-21 11:15:49 -04:00
b . Navigation ( "Provider" ) ;
2022-12-14 09:28:51 -05:00
b . Navigation ( "User" ) ;
} ) ;
[PM-21034] Feature Branch - "User Crypto V2" (#5982)
* [PM-21034] Database changes for signature keypairs (#5906)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Drop view if exists
* Enable nullable
* Replace with create or alter view
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* [PM-21034] Implement api changes to retreive signing keys (#5932)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* [PM-22384] Implement key-rotation based enrollment to user-crypto v2 (#5934)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Cleanup
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Fix build
* [PM-22862] Account security version (#5995)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Merge branch 'km/signing-upgrade-rotation' into km/account-security-version
* Add security state to rotation
* Update tests
* Update tests and check for security state in v2 model
* Cleanup
* Add tests
* Add security state data to integration test
* Re-sort and remove limit
* Update migrations
* Fix sql
* Fix sql
* Fix sql
* Fix fixture
* Fix test
* Fix test
* Fix test
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* [PM-22853] Add feature flag (#6090)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Merge branch 'km/signing-upgrade-rotation' into km/account-security-version
* Add security state to rotation
* Update tests
* Add feature flag
* Update tests and check for security state in v2 model
* Cleanup
* Add tests
* Add security state data to integration test
* Re-sort and remove limit
* Update migrations
* Fix sql
* Fix sql
* Fix sql
* Fix fixture
* Fix test
* Fix test
* Fix test
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* [PM-23222] Update revision date on key rotation (#6038)
* Add signing key repositories, models, and sql migration scripts
* Rename UserSigningKeys table to UserSigningKey
* Rename signedpublickeyownershipclaim to signedpublickey
* Move signedPublicKey to last parameter
* Add newline at end of file
* Rename to signature key pair
* Further rename to signaturekeypair
* Rename to UserSignatureKeyPairRepository
* Add newline
* Rename more instances to UserSignatureKeyPair
* Update parameter order
* Fix order
* Add more renames
* Cleanup
* Fix sql
* Add ef migrations
* Fix difference in SQL SP compared to migration SP
* Fix difference in SQL SP vs migration
* Fix difference in SQL SP vs migration
* Attempt to fix sql
* Rename migration to start later
* Address feedback
* Move UserSignatureKeyPair to KM codeownership
* Fix build
* Fix build
* Fix build
* Move out entitytypeconfiguration
* Use view for reading usersignaturekeypairs
* Fix migration script
* Fix migration script
* Add initial get keys endpoint
* Add sync response
* Cleanup
* Add query and fix types
* Add tests and cleanup
* Fix test
* Drop view if exists
* Add km queries
* Cleanup
* Enable nullable
* Cleanup
* Cleanup
* Enable nullable
* Fix incorrect namespace
* Remove unused using
* Fix test build
* Fix build error
* Fix build
* Attempt to fix tests
* Attempt to fix tests
* Replace with create or alter view
* Attempt to fix tests
* Attempt to fix build
* Rename to include async suffix
* Fix test
* Rename repo
* Attempt to fix tests
* Cleanup
* Test
* Undo test
* Fix tests
* Fix test
* Switch go generatecomb
* Switch to generatecomb
* Move signature algorithm
* Move useresignaturekeypairentitytypeconfiguration to km ownership
* Move userSignatureKeyPair model
* Unswap file names
* Move sql files to km ownership
* Add index on userid for signature keys
* Fix wrong filename
* Fix build
* Remove string length limit
* Regenerate EF migrations
* Undo changes to program.cs
* Cleanup
* Add migration to user encryption v2
* Fix build
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update util/Migrator/DbScripts/2025-06-01_00_AddSignatureKeyPairTable.sql
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Rename dbset to plural
* Cleanup
* Cleanup
* Fix build
* Fix test
* Add validation
* Fix test
* Apply fixes
* Fix tests
* Improve tests
* Add tests
* Add error message validation
* Fix tests
* Fix tests
* Fix test
* Add test
* Fix tests and errors
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Cleanup and move query to core
* Fix test
* Fix build
* Fix tests
* Update src/Api/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Switch away from primary constructor
* Use argumentNullException
* Add test
* Pass user account keys directly to profileresponsemodel
* Fix build
* Fix namespace
* Make signedpublickey optional
* Remove unused file
* Fix cases for request data conversion
* Revert constructor change
* Undo comments change
* Apply fixes
* Move registration to core
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/Startup.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove empty line
* Apply suggestions
* Fix tests
* Fix tests
* Fix build of integration tests
* Attempt to fix tests
* Add test
* Move v2 encryption user async below public functions
* Add todo
* Rename to have async suffix
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Address feedback
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test coverage
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Split up validation from rotation
* Fix tests
* Increase test coverage
* Rename tests
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Update src/Core/KeyManagement/UserKey/Implementations/RotateUserAccountkeysCommand.cs
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Add test for no signature keypair data
* Fix build
* Enable nullable
* Fix build
* Clean up data model
* Fix tests
* Merge branch 'km/signing-upgrade-rotation' into km/account-security-version
* Add security state to rotation
* Update tests
* Update revision date on key rotation
* Update tests and check for security state in v2 model
* Cleanup
* Add tests
* Add security state data to integration test
* Re-sort and remove limit
* Update migrations
* Fix sql
* Fix sql
* Fix sql
* Fix fixture
* Fix test
* Fix test
* Fix test
* Add test for change date
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
* Fix signing keys
* Update sql migrations
* Fix tests
* Add keys to identity token response
* Fix tests
* Fix tests
* Fix formatting
* Update src/Infrastructure.EntityFramework/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Infrastructure.Dapper/KeyManagement/Repositories/UserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Controllers/UsersController.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Requests/SignatureKeyPairRequestModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Api/KeyManagement/Models/Requests/PublicKeyEncryptionKeyPairRequestModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Entities/UserSignatureKeyPair.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Repositories/IUserSignatureKeyPairRepository.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Queries/UserAccountKeysQuery.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/PublicKeyEncryptionKeyPairData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Entities/UserSignatureKeyPair.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/RotateUserAccountKeysData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/SignatureKeyPairData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/SecurityStateData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Data/UserAccountKeysData.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Request/SecurityStateModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/PrivateKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/PublicKeysResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/PublicKeyEncryptionKeyPairResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Queries/Interfaces/IUserAcountKeysQuery.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Update src/Core/KeyManagement/Models/Response/SignatureKeyPairResponseModel.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Remove unnecessary file
* Add eof spacing
* Move models
* Fix build
* Move models to API subdirectory
* Rename model
* Remove migrations
* Add new ef migrations
* Remove empty line
* Only query account keys if the user has keys
* Dotnet format
* Fix test
* Update test/Identity.Test/IdentityServer/BaseRequestValidatorTests.cs
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
* Apply suggestion
* Fix whitespace
* Force camel case on response models
* Address feedback for sql files
* Fix build
* Make index unique
* Add contstraints
* Fix sql
* Fix order
* Cleanup
* Fix build
* Update migrations
* Update EF migrations
* Change parameters to nvarchar
* Update to Varchar
* Apply feedback
* Move refresh view
* Attempt to fix build
* Undo sql changes
* Apply feedback about varchar
* Apply feedback about refresh view
* Apply feedback about new lines
* Address SQL feedback
* Re-sort columns
* Fix build
* Fix order
* Fix build
---------
Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
2025-10-20 12:51:08 +02:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.UserSignatureKeyPair" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( )
. HasForeignKey ( "UserId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "User" ) ;
} ) ;
2024-09-09 14:52:12 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.NotificationCenter.Models.Notification" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( )
. HasForeignKey ( "OrganizationId" ) ;
2025-02-10 11:39:48 -05:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.Vault.Models.SecurityTask" , "Task" )
. WithMany ( )
2025-04-23 13:16:29 -05:00
. HasForeignKey ( "TaskId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
2025-02-10 11:39:48 -05:00
2024-09-09 14:52:12 -05:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( )
. HasForeignKey ( "UserId" ) ;
b . Navigation ( "Organization" ) ;
2025-02-10 11:39:48 -05:00
b . Navigation ( "Task" ) ;
2024-09-09 14:52:12 -05:00
b . Navigation ( "User" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.NotificationCenter.Models.NotificationStatus" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.NotificationCenter.Models.Notification" , "Notification" )
. WithMany ( )
. HasForeignKey ( "NotificationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( )
. HasForeignKey ( "UserId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Notification" ) ;
b . Navigation ( "User" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ApiKey" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount" , "ServiceAccount" )
2024-08-13 08:54:03 +10:00
. WithMany ( "ApiKeys" )
2023-02-01 12:27:13 -06:00
. HasForeignKey ( "ServiceAccountId" ) ;
b . Navigation ( "ServiceAccount" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Project" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2023-02-01 12:27:13 -06:00
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Secret" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2023-02-01 12:27:13 -06:00
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
2025-10-16 15:35:14 -04:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.SecretVersion" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.OrganizationUser" , "EditorOrganizationUser" )
. WithMany ( )
. HasForeignKey ( "EditorOrganizationUserId" )
. OnDelete ( DeleteBehavior . SetNull ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount" , "EditorServiceAccount" )
. WithMany ( )
. HasForeignKey ( "EditorServiceAccountId" )
. OnDelete ( DeleteBehavior . SetNull ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Secret" , "Secret" )
. WithMany ( "SecretVersions" )
. HasForeignKey ( "SecretId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "EditorOrganizationUser" ) ;
b . Navigation ( "EditorServiceAccount" ) ;
b . Navigation ( "Secret" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2024-11-08 10:28:56 -06:00
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Organization" ) ;
} ) ;
2023-03-23 13:08:49 +00:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Vault.Models.Cipher" , b = >
{
2023-12-13 07:03:42 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
2023-03-23 13:08:49 +00:00
. WithMany ( "Ciphers" )
. HasForeignKey ( "OrganizationId" ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( "Ciphers" )
. HasForeignKey ( "UserId" ) ;
b . Navigation ( "Organization" ) ;
b . Navigation ( "User" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Vault.Models.Folder" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.User" , "User" )
. WithMany ( "Folders" )
. HasForeignKey ( "UserId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "User" ) ;
} ) ;
2024-11-14 14:54:20 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Vault.Models.SecurityTask" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.Vault.Models.Cipher" , "Cipher" )
. WithMany ( )
2025-04-23 13:16:29 -05:00
. HasForeignKey ( "CipherId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
2024-11-14 14:54:20 -08:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , "Organization" )
. WithMany ( )
. HasForeignKey ( "OrganizationId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
b . Navigation ( "Cipher" ) ;
b . Navigation ( "Organization" ) ;
} ) ;
2023-01-13 15:02:53 +01:00
modelBuilder . Entity ( "ProjectSecret" , b = >
{
2023-02-01 12:27:13 -06:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Project" , null )
2023-01-13 15:02:53 +01:00
. WithMany ( )
. HasForeignKey ( "ProjectsId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
2023-02-01 12:27:13 -06:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Secret" , null )
2023-01-13 15:02:53 +01:00
. WithMany ( )
. HasForeignKey ( "SecretsId" )
. OnDelete ( DeleteBehavior . Cascade )
. IsRequired ( ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.GroupProjectAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Project" , "GrantedProject" )
2023-01-13 15:02:53 +01:00
. WithMany ( "GroupAccessPolicies" )
2023-09-21 17:22:08 -05:00
. HasForeignKey ( "GrantedProjectId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
2023-01-13 15:02:53 +01:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.Group" , "Group" )
. WithMany ( )
2023-09-21 17:22:08 -05:00
. HasForeignKey ( "GroupId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
2023-01-13 15:02:53 +01:00
b . Navigation ( "GrantedProject" ) ;
b . Navigation ( "Group" ) ;
} ) ;
2024-02-22 10:06:39 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.GroupSecretAccessPolicy" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Secret" , "GrantedSecret" )
. WithMany ( "GroupAccessPolicies" )
. HasForeignKey ( "GrantedSecretId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.Group" , "Group" )
. WithMany ( )
. HasForeignKey ( "GroupId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
b . Navigation ( "GrantedSecret" ) ;
b . Navigation ( "Group" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.GroupServiceAccountAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount" , "GrantedServiceAccount" )
. WithMany ( "GroupAccessPolicies" )
2023-01-13 15:02:53 +01:00
. HasForeignKey ( "GrantedServiceAccountId" ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.Group" , "Group" )
. WithMany ( )
2023-09-21 17:22:08 -05:00
. HasForeignKey ( "GroupId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
2023-01-13 15:02:53 +01:00
b . Navigation ( "GrantedServiceAccount" ) ;
b . Navigation ( "Group" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccountProjectAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Project" , "GrantedProject" )
2023-01-13 15:02:53 +01:00
. WithMany ( "ServiceAccountAccessPolicies" )
2023-09-21 17:22:08 -05:00
. HasForeignKey ( "GrantedProjectId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
2023-01-13 15:02:53 +01:00
2023-02-01 12:27:13 -06:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount" , "ServiceAccount" )
2024-08-13 08:54:03 +10:00
. WithMany ( "ProjectAccessPolicies" )
2023-01-13 15:02:53 +01:00
. HasForeignKey ( "ServiceAccountId" ) ;
b . Navigation ( "GrantedProject" ) ;
b . Navigation ( "ServiceAccount" ) ;
} ) ;
2024-02-22 10:06:39 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccountSecretAccessPolicy" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Secret" , "GrantedSecret" )
. WithMany ( "ServiceAccountAccessPolicies" )
. HasForeignKey ( "GrantedSecretId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount" , "ServiceAccount" )
. WithMany ( )
. HasForeignKey ( "ServiceAccountId" ) ;
b . Navigation ( "GrantedSecret" ) ;
b . Navigation ( "ServiceAccount" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.UserProjectAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Project" , "GrantedProject" )
2023-01-13 15:02:53 +01:00
. WithMany ( "UserAccessPolicies" )
2023-09-21 17:22:08 -05:00
. HasForeignKey ( "GrantedProjectId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
2023-01-13 15:02:53 +01:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.OrganizationUser" , "OrganizationUser" )
. WithMany ( )
. HasForeignKey ( "OrganizationUserId" ) ;
b . Navigation ( "GrantedProject" ) ;
b . Navigation ( "OrganizationUser" ) ;
} ) ;
2024-02-22 10:06:39 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.UserSecretAccessPolicy" , b = >
{
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Secret" , "GrantedSecret" )
. WithMany ( "UserAccessPolicies" )
. HasForeignKey ( "GrantedSecretId" )
. OnDelete ( DeleteBehavior . Cascade ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.OrganizationUser" , "OrganizationUser" )
. WithMany ( )
. HasForeignKey ( "OrganizationUserId" ) ;
b . Navigation ( "GrantedSecret" ) ;
b . Navigation ( "OrganizationUser" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.UserServiceAccountAccessPolicy" , b = >
2023-01-13 15:02:53 +01:00
{
2023-02-01 12:27:13 -06:00
b . HasOne ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount" , "GrantedServiceAccount" )
. WithMany ( "UserAccessPolicies" )
2023-01-13 15:02:53 +01:00
. HasForeignKey ( "GrantedServiceAccountId" ) ;
b . HasOne ( "Bit.Infrastructure.EntityFramework.Models.OrganizationUser" , "OrganizationUser" )
. WithMany ( )
. HasForeignKey ( "OrganizationUserId" ) ;
b . Navigation ( "GrantedServiceAccount" ) ;
b . Navigation ( "OrganizationUser" ) ;
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization" , b = >
2022-12-14 09:28:51 -05:00
{
b . Navigation ( "ApiKeys" ) ;
b . Navigation ( "Ciphers" ) ;
2023-03-02 08:50:27 -05:00
b . Navigation ( "Collections" ) ;
2022-12-14 09:28:51 -05:00
b . Navigation ( "Connections" ) ;
2023-03-02 08:50:27 -05:00
b . Navigation ( "Domains" ) ;
2022-12-14 09:28:51 -05:00
b . Navigation ( "Groups" ) ;
b . Navigation ( "OrganizationUsers" ) ;
b . Navigation ( "Policies" ) ;
b . Navigation ( "SsoConfigs" ) ;
b . Navigation ( "SsoUsers" ) ;
b . Navigation ( "Transactions" ) ;
} ) ;
2023-12-13 07:03:42 -08:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Collection" , b = >
{
b . Navigation ( "CollectionCiphers" ) ;
b . Navigation ( "CollectionGroups" ) ;
b . Navigation ( "CollectionUsers" ) ;
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.Group" , b = >
{
b . Navigation ( "GroupUsers" ) ;
} ) ;
2022-12-14 09:28:51 -05:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.OrganizationUser" , b = >
{
b . Navigation ( "CollectionUsers" ) ;
2023-01-13 14:24:58 -05:00
b . Navigation ( "GroupUsers" ) ;
2022-12-14 09:28:51 -05:00
} ) ;
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Models.User" , b = >
{
b . Navigation ( "Ciphers" ) ;
b . Navigation ( "Folders" ) ;
b . Navigation ( "OrganizationUsers" ) ;
b . Navigation ( "SsoUsers" ) ;
b . Navigation ( "Transactions" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Project" , b = >
{
b . Navigation ( "GroupAccessPolicies" ) ;
b . Navigation ( "ServiceAccountAccessPolicies" ) ;
b . Navigation ( "UserAccessPolicies" ) ;
} ) ;
2024-02-22 10:06:39 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.Secret" , b = >
{
b . Navigation ( "GroupAccessPolicies" ) ;
2025-10-16 15:35:14 -04:00
b . Navigation ( "SecretVersions" ) ;
2024-02-22 10:06:39 -06:00
b . Navigation ( "ServiceAccountAccessPolicies" ) ;
b . Navigation ( "UserAccessPolicies" ) ;
} ) ;
2023-02-01 12:27:13 -06:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.SecretsManager.Models.ServiceAccount" , b = >
{
2024-08-13 08:54:03 +10:00
b . Navigation ( "ApiKeys" ) ;
2023-02-01 12:27:13 -06:00
b . Navigation ( "GroupAccessPolicies" ) ;
2024-08-13 08:54:03 +10:00
b . Navigation ( "ProjectAccessPolicies" ) ;
2023-02-01 12:27:13 -06:00
b . Navigation ( "UserAccessPolicies" ) ;
} ) ;
2023-03-23 13:08:49 +00:00
modelBuilder . Entity ( "Bit.Infrastructure.EntityFramework.Vault.Models.Cipher" , b = >
{
b . Navigation ( "CollectionCiphers" ) ;
} ) ;
2022-12-14 09:28:51 -05:00
#pragma warning restore 612 , 618
}
}
}