1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-23 12:25:16 +01:00
Commit Graph

101 Commits

Author SHA1 Message Date
Vijay Oommen
cb7eecc96d
PM-13236 PasswordHealthReportApplication DB Tables (#4958)
* PM-13236 PasswordHealthReportApplications db

* PM-13236 incorporated pr comments

* PM-13236 fixed error in SQL script

* PM-13236 resolve quality scan errors SQL71006, SQL7101, SQL70001

* PM-13236 fixed warnings on procedures

* PM-13236 added efMigrations

* PM-13236 renamed files to PasswordHealthReportApplication (singular)

* PM-13236 changed file name to more appropriate naming

* PM-13236 changed the file name singular

* PM-13236 removed the entity file

* PM-13236 Moved PasswordHealthReportApplication entity to src/core/tools/entities
2024-11-04 14:23:39 -05:00
Matt Bishop
a04df4beba
Device deactivation (#4963)
* Device deactivation

* Check active status in service

* Format and work around potential deadlocks
2024-10-31 17:05:13 -04:00
Alex Morask
c44988694d
[AC-2551] Fix migration files (#4854)
* Correctly regenerate EF migration files

* Run dotnet format
2024-10-04 12:05:44 -04:00
Alex Morask
0496085c39
[AC-2551] Consolidated Billing Migration (#4616)
* Move existing Billing SQL files into dbo folder

I noticed that every other team had a nested dbo folder under their team folder while Billing did not. This change replicates that.

* Add SQL files for ClientOrganizationMigrationRecord table

* Add SQL Server migration for ClientOrganizationMigrationRecord table

* Add ClientOrganizationMigrationRecord entity and repository interface

* Add ClientOrganizationMigrationRecord Dapper repository

* Add ClientOrganizationMigrationRecord EF repository

* Add EF migrations for ClientOrganizationMigrationRecord table

* Implement migration process

* Wire up new Admin tool to migrate providers

* Run dotnet format

* Updated coupon and credit application per product request

* AC-3057-3058: Fix expiration date and enabled from webhook processing

* Run dotnet format

* AC-3059: Fix assigned seats during migration

* Updated AllocatedSeats in the case plan already exists

* Update migration scripts to reflect current date
2024-10-04 10:55:00 -04:00
Addison Beck
6a51e3b1a9
Split LimitCollectionCreationDeletion into two database columns (#4709)
* Add new columns to `dbo.Organization` & its references

* Feed existing data into new `dbo.Organization` column

* Update Entity Framework database definitions

* Move new EF columns out of the core entity definition

* Generate Entity Framework migrations

* Feed existing data into new `Organization` Entity Framework columns

* Add a where clause to SQL migration
2024-10-03 13:43:54 -04:00
Thomas Rittson
f7bc5dfb2e
[PM-10365] Drop OrganizationUser AccessAll (#4701)
* Remove OrganizationUser.AccessAll

* Final database migrations
2024-09-24 16:26:35 +10:00
Ike
02fee8c1e9
[PM-8108] Add Duo SDK v4 metadata to Duo Two Factor Provider (#4774)
* Migrate Duo Two Factor Configuration to support both v2 and v4

* Postgres Migrations

* SQLite migrations

* comment updates for SQLite; Query changes for consistency;

* comment clean up; formatting
2024-09-23 15:51:04 -07:00
Thomas Avery
4c0f8d54f3
[PM-10560] Create notification database storage (#4688)
* Add new tables

* Add stored procedures

* Add core entities and models

* Setup EF

* Add repository interfaces

* Add dapper repos

* Add EF repos

* Add order by

* EF updates

* PM-10560: Notifications repository matching requirements.

* PM-10560: Notifications repository matching requirements.

* PM-10560: Migration scripts

* PM-10560: EF index optimizations

* PM-10560: Cleanup

* PM-10560: Priority in natural order, Repository, sql simplifications

* PM-10560: Title column update

* PM-10560: Incorrect EF migration removal

* PM-10560: EF migrations

* PM-10560: Added views, SP naming simplification

* PM-10560: Notification entity Title update, EF migrations

* PM-10560: Removing Notification_ReadByUserId

* PM-10560: Notification ReadByUserIdAndStatus fix

* PM-10560: Notification ReadByUserIdAndStatus fix to be in line with requirements and EF

---------

Co-authored-by: Maciej Zieniuk <mzieniuk@bitwarden.com>
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
2024-09-09 21:52:12 +02:00
Rui Tomé
f5caecc6d6
[AC-1722] Deprecate "Edit/Delete Assigned Collections" custom permissions (#4604)
* 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>
2024-09-02 11:04:55 +01:00
Thomas Rittson
0da62f9cee
[PM-10368] Drop Group.AccessAll (#4700)
- Add default constraint
- Update sprocs to remove column
- Drop column
2024-09-02 15:01:32 +10:00
Justin Baur
13ad872f51
Resolve Vault and DB Warnings (#4646)
* Resolve Vault Warnings

* Resolve DB Warnings
2024-08-27 19:05:34 -04:00
Thomas Rittson
22bd755b3c
[AC-10362] Remove OrganizationUser.AccessAll from code (#4622)
* Remove OrganizationUser.AccessAll from code

* Add shadow property

* Remove remaining reference

* dotnet format

* Fix tests

* Bump migration dates
2024-08-26 12:03:44 +01:00
renovate[bot]
8253de350b
[deps] DbOps: Update EntityFrameworkCore to v8.0.8 (#4651)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-19 14:21:16 -04:00
Thomas Rittson
f04c3b8e54
[PM-10361] Remove Group.AccessAll from code (#4614)
* Remove Group.AccessAll from code

* Add shadow property config and migration
2024-08-13 08:54:03 +10:00
Thomas Rittson
ffdc40b21c
[AC-2881] Remove Organization.FlexibleCollections from code (#4552)
* 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)
2024-07-26 15:07:33 +10:00
Justin Baur
1e0182008b
[PM-2943] Enable Nullable Repositories in Unowned Files (#4549)
* Enable Nullable In Unowned Repos

* Update More Tests

* Move to One If

* Fix Collections

* Format

* Add Migrations

* Move Pragma Annotation

* Add Better Assert Message
2024-07-24 09:48:09 -04:00
renovate[bot]
41135c866d
[deps] DbOps: Update EntityFrameworkCore to v8.0.7 (#4484)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-09 12:11:35 -04:00
Alex Morask
9c8a9f41fb
[AC-2804] Add client ID to provider client invoice report (#4458)
* Add client ID to provider client invoice report

* Run dotnet format
2024-07-05 10:12:03 -04:00
Justin Baur
8b5f65fc00
PM-2944] Make Entities Nullable In Admin Console (#4386)
* Enable `nullable` in `ISubscriber`

* Enable `nullable` in `Group`

* Enable `nullable` in `GroupUser`

* Enable `nullable` in `Organization`

* Enable `nullable` in `OrganizationUser`

* Enable `nullable` in `Policy`

* Enable `nullable` in `Provider`

* Enable `nullable` in `ProviderOrganization`

* Enable `nullable` in `ProviderUser`

* Update Tests

* Formatting

* Update TwoFactor Tests

* Fix Scim Tests

* Format

* Add Migrations

* Format
2024-07-04 21:14:37 -04:00
Justin Baur
8d1f6a9f66
[PM-2944] Update Null DB Constraints (#4459)
* Update Database Models

* Format
2024-07-03 16:21:25 -04:00
Kyle Spearrin
0d3a7b3dd5
[PM-5518] Sql-backed IDistributedCache (#3791)
* 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>
2024-07-03 12:48:23 -04:00
Matt Bishop
e8c5d73062
Sync EF migrations for .NET / EF Core 8 (#4448)
* Sync EF migrations for .NET 8

* Format

* Redo migrations with billing fix

* Forgot to format again
2024-07-02 10:08:34 -04:00
renovate[bot]
563adf54af
[deps] DbOps: Update EntityFrameworkCore to v8 (major) (#3744)
* [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>
2024-06-27 08:45:34 -04:00
renovate[bot]
a1d609b208
[deps] DbOps: Update EntityFrameworkCore (#3981)
* [deps] DbOps: Update EntityFrameworkCore

* Update linq2db Package

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
2024-06-07 09:55:59 -04:00
Alex Morask
725fc2eed3
[AC-1943] Add ProviderInvoiceItem table (#4163)
* Add ProviderInvoiceItem table

* Run dotnet format
2024-06-06 13:25:13 -04:00
Ike
97b3f3e7ee
[PM-5216] User and Organization Duo Request and Response Model refactor (#4126)
* 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
2024-06-05 11:42:02 -07:00
Rui Tomé
b3e5076128
[AC-1978] Flexible collections: EF data migrations for deprecated permissions (#3969)
* [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>
2024-04-26 14:11:29 +01:00
Alex Morask
9f7e05869e
[AC-1900] Update Vault DB to support provider billing (#3875)
* Add Gateway columns to Provider table

* Add ProviderId column to Transaction table

* Create ProviderPlan table

* Matt's feedback

* Rui's feedback

* Fixed Gateway parameter on Provider
2024-03-21 11:15:49 -04:00
Tom
997af0f6ab
[PM-221] Adding CipherId to the Send table, create/update sprocs, and added mi… (#3646)
* Adding CipherId to the Send table, create/update sprocs, and added migrations

* changing migrator script to drop create sprocs

* fixing double brackets

* Revert "changing migrator script to drop create sprocs"

This reverts commit 2d5171e7e5.

* Remove comment I nitpicked

* Script best practices

* Fix typo

* Try recreate again

* Fix missing output

* Revert "Try recreate again"

This reverts commit 38257ebeaa.

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
Co-authored-by: federicom09 <fmonesiglio@bitwarden.com>
2024-03-04 19:31:33 -05:00
Thomas Avery
1499d1e2c6
[SM-713] Add database support for secret access policies (#3681)
* 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
2024-02-22 10:06:39 -06:00
renovate[bot]
4e6360cc4f
[deps] DbOps: Update EntityFrameworkCore (#3823)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-20 09:42:30 -05:00
Colton Hurst
7cbe888b82
SM-1012: Removing SM Beta (Phase 2) (#3663)
* 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
2024-02-05 15:51:31 -05:00
Matt Bishop
ae1fdb0992
[PM-5052] Upgrade to .NET 8 (#3461)
* 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
2024-02-05 13:03:42 -05:00
Thomas Avery
880ceafe9f
[BEEEP] [SM-1059] Add missing auth table indexes to EF config (#3625)
* Add missing indexes to EF auth tables

* Add EF migrations
2024-01-17 10:42:43 -06:00
Matt Bishop
b97a1a9ed2
[PM-5519] [PM-5526] [PM-5624] [PM-5600] More Grant SQL fixes (#3668)
* SQLite scripts to apply autoincrementing Id key

* Drop erroneous Id column if created
2024-01-16 09:08:55 -05:00
renovate[bot]
2df5fe1340
[deps] SM: Update EntityFrameworkCore to v7.0.15 (#3666)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-12 16:30:23 -07:00
Matt Bishop
db4d7aa609
[PM-5519] [PM-5526] [PM-5624] [PM-5600] Tweak EF settings for MySQL grant auto-increment (#3662)
* 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
2024-01-11 16:06:29 -05:00
Thomas Rittson
b829812a3f
[AC-2025] Add Organization.FlexibleCollections to database and sprocs (#3642)
* Add Organization.FlexibleCollections property and column

* Add new property to OrganizationAbility

* Add SQL and EF migrations
2024-01-11 13:25:57 +10:00
Thomas Avery
3392ede534
[BEEEP][SM-1062] Add missing table indexes to EF config (#3628)
* Add missing EF indexes

* Add EF migrations

* move configs

* regenerate migrations
2024-01-10 12:03:16 -06:00
Thomas Avery
a480bd16e4
[BEEEP] [SM-1060] Add missing tools table indexes to EF config (#3626)
* Add missing indexes

* Add EF migrations
2024-01-09 09:46:45 -06:00
renovate[bot]
bfa9269b42
[PM-5294][deps]: Update Duende.IdentityServer to v6.3.7 (#3499)
* [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>
2023-12-28 15:04:45 -05:00
Ike
8bf798a79f
added webauthncredential ef migrations (#3555) 2023-12-13 07:03:42 -08:00
Matt Bishop
890a09804f
Stop using lockfiles (#3550) 2023-12-12 09:09:42 -05:00
renovate[bot]
43eea0d297
[deps] Billing: Update Braintree to v5.21.0 (#3537)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 14:46:39 -05:00
renovate[bot]
62bf2a146f
[deps] Tools: Update MailKit to v4.3.0 (#3533)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 18:21:26 +01:00
renovate[bot]
baafbe4576
[deps] Tools: Update SendGrid to v9.28.1 (#3534)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 18:07:33 +01:00
renovate[bot]
3e323ae3d9
[deps] Platform: Update dotnet monorepo to v6.0.25 (#3507)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 12:04:13 -05:00
renovate[bot]
3ecec808b6
[deps] Billing: Update Serilog.Extensions.Logging.File to v3 (#3069)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 11:54:20 -05:00
github-actions[bot]
26e6093c14
Bumped version to 2023.12.0 (#3519)
Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>
2023-12-05 10:55:20 -05:00
renovate[bot]
333a51b3f2
[deps] Tools: Update Handlebars.Net to v2.1.4 (#3508)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-04 12:02:30 +01:00