* Added /domain/sso/verified to organization controller
* Restricting sproc to only return verified domains if the org has sso. Adding name. corrected route. removed not found exception. Adding the sproc definition to the SQL project
* 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
* PM-11123: Notification Status Details view
* PM-11123: Test Typo
* PM-11123: New line missing
* PM-11123: Delete unnecessary field
* PM-11123: Moved NotificationStatusDetails to Models/Data
* 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
* 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
* Changes to make all teams and ent plan visible
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Resolve the typeo
---------
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Add HasVerifiedDomainsAsync method to IOrganizationDomainService
* Add GetManagedUserIdsByOrganizationIdAsync method to IOrganizationUserRepository and the corresponding queries
* Fix case on the sproc OrganizationUser_ReadManagedIdsByOrganizationId parameter
* Update the EF query to use the Email from the User table
* dotnet format
* Fix IOrganizationDomainService.HasVerifiedDomainsAsync by checking that domains have been Verified and add unit tests
* Rename IOrganizationUserRepository.GetManagedUserIdsByOrganizationAsync
* Fix domain queries
* Add OrganizationUserRepository integration tests
* Add summary to IOrganizationDomainService.HasVerifiedDomainsAsync
* chore: Rename IOrganizationUserRepository.GetManagedUserIdsByOrganizationAsync to GetManyIdsManagedByOrganizationIdAsync
* Add IsManagedByAnyOrganizationAsync method to IUserRepository
* Add integration tests for UserRepository.IsManagedByAnyOrganizationAsync
* Refactor to IUserService.IsManagedByAnyOrganizationAsync and IOrganizationService.GetUsersOrganizationManagementStatusAsync
* chore: Refactor IsManagedByAnyOrganizationAsync method in UserService
* Refactor IOrganizationService.GetUsersOrganizationManagementStatusAsync to return IDictionary<Guid, bool>
* Extract IOrganizationService.GetUsersOrganizationManagementStatusAsync into a query
* Update comments in OrganizationDomainService to use proper capitalization
* Move OrganizationDomainService to AdminConsole ownership and update namespace
* feat: Add support for organization domains in enterprise plans
* feat: Add HasOrganizationDomains property to OrganizationAbility class
* refactor: Update GetOrganizationUsersManagementStatusQuery to use IApplicationCacheService
* Remove HasOrganizationDomains and use UseSso to check if Organization can have Verified Domains
* Refactor UserService.IsManagedByAnyOrganizationAsync to simply check the UseSso flag
* Add TODO comment for replacing 'UseSso' organization ability on user verified domain checks
* Bump date on migration script
* Add indexes to OrganizationDomain table
* Bump script migration date; Remove WITH ONLINE = ON from data migration.
* Added invoices and transaction history endpoints. Added cursor paging for each
* Removed try/catch since it's handled by middleware. Updated condition to use pattern matching
* Added unit tests for PaymentHistoryService
* Removed organizationId from account billing controller endpoints
* 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>
* [PM-10589] Update database defaults for collection management settings
* Update default values for 'LimitCollectionCreationDeletion' and 'AllowAdminAccessToAllCollectionItems' in Organization table
* Add checks before column constraint drop and constraint creation
* feat: Add stored procedure for reading organization user details with premium access by organization ID
The code changes include:
- Addition of a new stored procedure [dbo].[OrganizationUserUserDetailsWithPremiumAccess_ReadByOrganizationId] to read organization user details with premium access by organization ID
- Modification of the IUserService interface to include an optional parameter for checking two-factor authentication with premium access
- Modification of the UserService class to handle the new optional parameter in the TwoFactorIsEnabledAsync method
- Addition of a new method GetManyDetailsWithPremiumAccessByOrganizationAsync in the IOrganizationUserRepository interface to retrieve organization user details with premium access by organization ID
- Addition of a new view [dbo].[OrganizationUserUserDetailsWithPremiumAccessView] to retrieve organization user details with premium access
* Add IUserRepository.SearchDetailsAsync that includes the field HasPremiumAccess
* Check the feature flag on Admin.UsersController to see if the optimization runs
* Modify PolicyService to run query optimization if the feature flag is enabled
* Refactor the parameter check on UserService.TwoFactorIsEnabledAsync
* Run query optimization on public MembersController if feature flag is enabled
* Restore refactor
* Reverted change used for development
* Add unit tests for OrganizationService.RestoreUser
* Separate new CheckPoliciesBeforeRestoreAsync optimization into new method
* Add more unit tests
* Apply refactor to bulk restore
* Add GetManyDetailsAsync method to IUserRepository. Add ConfirmUsersAsync_vNext method to IOrganizationService
* Add unit tests for ConfirmUser_vNext
* Refactor the optimization to use the new TwoFactorIsEnabledAsync method instead of changing the existing one
* Removed unused sql scripts and added migration script
* Remove unnecessary view
* chore: Remove unused SearchDetailsAsync method from IUserRepository and UserRepository
* refactor: Use UserDetails constructor in UserRepository
* Add summary to IUserRepository.GetManyDetailsAsync
* Add summary descriptions to IUserService.TwoFactorIsEnabledAsync
* Remove obsolete annotation from IUserRepository.UpdateUserKeyAndEncryptedDataAsync
* refactor: Rename UserDetails to UserWithCalculatedPremium across the codebase
* Extract IUserService.TwoFactorIsEnabledAsync into a new TwoFactorIsEnabledQuery class
* Add unit tests for TwoFactorIsEnabledQuery
* Update TwoFactorIsEnabledQueryTests to include additional provider types
* Refactor TwoFactorIsEnabledQuery
* Refactor TwoFactorIsEnabledQuery and update tests
* refactor: Update TwoFactorIsEnabledQueryTests to include test for null TwoFactorProviders
* refactor: Improve TwoFactorIsEnabledQuery and update tests
* refactor: Improve TwoFactorIsEnabledQuery and update tests
* Remove empty <returns> from summary
* Update User_ReadByIdsWithCalculatedPremium stored procedure to accept JSON array of IDs
* Updated org edit form scripts to dynamically update expected values
* Added script to update null values on organization table
* Updated script to only add MaxStorageGb for premium tiers. Removed setting of seats since it's not a valid edge case
* Updated GetPlansHelper() to not use annonymous properties
* 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)
These sprocs were used to remove AccessAll from
cipher access logic. Now the original sprocs have been
updated with the new logic, these v2 sprocs are unused
and are being dropped to complete the EDD cycle.
These updated sprocs removed AccessAll from cipher access logic.
The non-versioned sprocs have been updated with the new logic and
these v2 copies are now unused. They are being dropped to complete
the EDD cycle.
Final removal of AccessAll logic in CollectionCipher sprocs. We had v2 sprocs already
containing this updated logic that were never used; copy the v2 logic back to the
original sprocs so that we start using it. v2 sprocs will be dropped later.
* 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>
* Added check for revoked users
* removed check for users as any user status with can manage access should hide the add access badge
* updated comments
* [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>