* Add SQL script to migrate custom users with specific permissions to User type
Remove 'editAssignedCollections' and 'deleteAssignedCollections' properties from Permissions in OrganizationUser table. Migrate custom users who only have these permissions to the User type.
* Add MySQL migration to migrate custom users with specific permissions to User type
* Add Postgres migration to migrate custom users with specific permissions to User type
* Add Sqlite migration to migrate custom users with specific permissions to User type
* Update AutoFixture usage in tests to resolve creating ILogger mock instances
* Update EF integration tests database contexts to use each respective Migrations assembly. Configure Sqlite instance
* Add RunMigration method to BaseEntityFrameworkRepository
* Add FinalFlexibleCollectionsDataMigrationsTests
* Improve data migration efficiency by using OPENJSON instead of multiple JSON_EXTRACT
* Add batching to the sql data migrations
* Update DbMigrator to run a specific script based on its name
* Update DatabaseDataAttribute to be able to test a specific migration
* Add reference to the migration projects to Infrastructure.IntegrationTest
* Add integration test to test the migration FinalFlexibleCollectionsDataMigrations
* Remove EFIntegration tests and remove RunMigration method from BaseEntityFrameworkRepository
* Add IMigrationTesterService and implementations for SQL and EF migrations
* Add FinalFlexibleCollectionsDataMigrationsTests and remove test from OrganizationUserRepositoryTests
* Update sql data migration script based on performance feedback
* Bump date on EF migration scripts
* Add xmldoc comments to IMigrationTesterService and each implementation
* Bump up the date on the EF migration scripts
* Bump up dates on EF migrations
* Added tests to assert no unwanted changes are made to the permissions json. Refactor tests.
* Revert changes made to DbMigrator and refactor SqlMigrationTesterService to not use it.
* Add method description
* Fix test to assert no changes are made to custom user
* Remove unnecessary COALESCE and SELECT CASE
* Unident lines on SQL script
* Update DatabaseDataAttribute MigrationName property to be nullable
* Fix null reference checks
* Remove unnecessary COALESCE from Postgres script
* Bump dates on migration scripts
* Bump up dates on EF migrations
* Add migration tests for handling null
* Add test for non json values
* Fix test
* Remove migrations
* Recreate EF migrations
* Update Postgres data migration script to check for valid JSON in Permissions column
---------
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
* Remove Organization.FlexibleCollections from code
* Drop Organization.FlexibleCollections column in EF databases
(MSSQL column to be retained for 1 additional deployment to support rollback in cloud)
* Sql-backed IDistributedCache
* sqlserver cache table
* remove unused using
* setup EF entity
* cache indexes
* add back cipher
* revert SetupEntityFramework change
* ef cache
* EntityFrameworkCache
* IServiceScopeFactory for db context
* implement EntityFrameworkCache
* move to _serviceScopeFactory
* move to config file
* ef migrations
* fixes
* datetime and error codes
* revert migrations
* migrations
* format
* static and namespace fix
* use time provider
* Move SQL migration and remove EF one for the moment
* Add clean migration of just the new table
* Formatting
* Test Custom `IDistributedCache` Implementation
* Add Back Logging
* Remove Double Logging
* Skip Test When Not EntityFrameworkCache
* Format
---------
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* [deps] DbOps: Update EntityFrameworkCore to v8
* Only Run EnsureDeleted If Factory Owns Connection
This only worked because of a bug in dotnet/efcore#33930 that was fixed in 8.0.
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
* inital changes
* add provider GatewayType migrations
* db provider migrations
* removed duo migrations added v2 metadata to duo response
* removed helper scripts
* remove signature from org duo
* added backward compatibility for Duo v2
* added tests for duo request + response models
* refactors to TwoFactorController
* updated test methods to be compartmentalized by usage
* fix organization add duo
* Assert.Empty() fix for validator
* [AC-1682] Added MySql migration and script
(cherry picked from commit d367f6de6b)
* [AC-1682] Added Postgres migration and script
(cherry picked from commit 9bde1604da)
* [AC-1682] Added Sqlite migration and script
(cherry picked from commit 262887f9c3)
* [AC-1682] dotnet format
(cherry picked from commit 00eea0621c)
* [AC-1682] Fixed Sqlite query
(cherry picked from commit 26f5bf8afd)
* [AC-1682] Drop temp tables if they exist when starting the scripts
(cherry picked from commit c20912f95c)
* [AC-1682] Removed MySql transaction from script because EF migration already wraps it under its own transaction
(cherry picked from commit 7b54d78d67)
* [AC-1682] Setting FlexibleCollections = 1 only for Orgs that had data migrated in previous steps
(cherry picked from commit 28bba94d81)
* [AC-1682] Updated queries to check for OrganizationId
(cherry picked from commit a957530d5e)
* [AC-1682] Fixed MySql script
(cherry picked from commit deee483ab7)
* [AC-1682] Fixed Postgres query
(cherry picked from commit c3ca9ec3c8)
* [AC-1682] Fix Sqlite query
(cherry picked from commit fada0a81bf)
* [AC-1682] Reverted scripts back to enabling Flexible Collections to all existing Orgs
(cherry picked from commit bd3b21b969)
* [AC-1682] Removed dropping temporary table from scripts
(cherry picked from commit eb7794d592)
* [AC-1682] Removed other temp table drops
(cherry picked from commit 26768b7bf8)
* [AC-1978] Fix issue that allows the web app to have the user type Manager available
(cherry picked from commit 2890f78870)
* [AC-1682] Bump dates on migration scripts
---------
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
* mssql add column and migration
* Add secret access policies to EF models and config
* Clear new access policies on service account delete
* Add SM cleanup code on delete
* Fix EF org user bulk delete
* Run EF migrations
* SM-1012: Phase 2, removing SM Beta from the server (but not db)
* SM-1012: Add migration for RemoveSMBetaFromOrganization
* SM-1012: Dotnet format
* SM-1012: Undo RemoveSMBetaFromOrganization EF migration
* SM-1012: Redo RemoveSMBetaFromOrganization EF migration
* SM-1012: Ran dotnet format
* Upgrade to .NET 8
* Linting
* Clean up old JSON deserialization code
* More .NET 8-oriented linting
* Light feedback
* Get rid of old test we don't know the root issue for
* Fix a new test
* Remove now-unnecessary Renovate constraint
* Use Any()
* Somehow a 6.0 tooling config we don't need snuck back in
* Space out properties that always change per release
* Bump a few core packages since the last update
* Tweak EF settings for grant auto-increment
* Go back to zero generated default as that doesn't matter
* Explicit value generation callout
* Go with custom SQL for direct automatic increment
* Proper column creation
* Lint
* [deps]: Update Duende.IdentityServer to v6.3.6
* Fix test
* Grant table changes
* Reassert view
* EF migrations
* Restore non-null key and simpler index
* Master SQL sync
* Lint
* Fix ID setting since the property isn't exposed
* Bump to .7
* Point to new Duende package
* Drop unused indexes first
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
* Upgrade to Duende.Identity
* Linting
* Get rid of last IdentityServer4 package
* Fix identity test since Duende returns additional configuration
* Use Configure
PostConfigure is ran after ASP.NET's PostConfigure
so ConfigurationManager was already configured and our HttpHandler wasn't
being respected.
* Regenerate lockfiles
* Move to 6.0.4 for patches
* fixes with testing
* Add additional grant type supported in 6.0.4 and beautify
* Lockfile refresh
* Reapply lockfiles
* Apply change to new WebAuthn logic
* When automated merging fails me
---------
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com>
* Upgrade to SDK v8
* Provide application properties
* Test adjustments
* Clean up tests
* Ensure project name is set
* Add a 'v' for Git tagging support