1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-24 12:35:25 +01:00
bitwarden-server/test/Core.Test
Rui Tomé 8d69bb0aaa
[AC-1698] Check if a user has 2FA enabled more efficiently (#4524)
* 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
2024-08-08 15:43:45 +01:00
..
AdminConsole [AC-1698] Check if a user has 2FA enabled more efficiently (#4524) 2024-08-08 15:43:45 +01:00
Auth [AC-1698] Check if a user has 2FA enabled more efficiently (#4524) 2024-08-08 15:43:45 +01:00
AutoFixture [AC-2646] Remove FC MVP dead code from Core (#4281) 2024-07-12 12:25:04 -05:00
Billing [AC-2888] Improve consolidated billing error handling (#4548) 2024-07-31 09:26:44 -04:00
Entities [AC-1283] AC Team code ownership moves: Organization (pt 2) (#3486) 2023-11-29 15:31:15 -06:00
Helpers Run formatting (#2230) 2022-08-29 16:06:55 -04:00
Models [PM-8830] Billing Enums Rename (#4180) 2024-06-14 15:34:47 -04:00
OrganizationFeatures [PM-8830] Billing Enums Rename (#4180) 2024-06-14 15:34:47 -04:00
Resources Run formatting (#2230) 2022-08-29 16:06:55 -04:00
SecretsManager [SM-654] Individual secret permissions (#4160) 2024-06-20 12:45:28 -05:00
Services [PM-10292] Remove Flexible Collections v1 from Core (#4579) 2024-08-06 11:14:16 -05:00
Tokens Run formatting (#2230) 2022-08-29 16:06:55 -04:00
Tools Replace async void with async Task (#3835) 2024-02-22 11:59:08 -05:00
Utilities [PM-8830] Billing Enums Rename (#4180) 2024-06-14 15:34:47 -04:00
Vault [AC-2881] Remove Organization.FlexibleCollections from code (#4552) 2024-07-26 15:07:33 +10:00
ConstantsTests.cs [PM-3565] Enforce higher minimum KDF (#3304) 2023-12-05 17:21:46 +01:00
Core.Test.csproj Remove moq (#3166) 2023-08-10 17:03:42 +02:00
TempDirectory.cs Run formatting (#2230) 2022-08-29 16:06:55 -04:00