* Added CQRS pattern
* Added the GetManyByUserIdAsync signature to the repositiory
* Added sql sproc
Created user defined type to hold status
Created migration file
* Added ef core query
* Added absract and concrete implementation for GetManyByUserIdStatusAsync
* Added integration tests
* Updated params to status
* Implemented new query to utilize repository method
* Added controller for the security task endpoint
* Fixed lint issues
* Added documentation
* simplified to require single status
modified script to check for users with edit rights
* Updated ef core query
* Added new assertions
* simplified to require single status
* fixed formatting
* Fixed sql script
* Removed default null
* Added security tasks feature flag
* feat(BaseRequestValidator):
Add global setting for new device verification.
Refactor BaseRequestValidator enabling better self-documenting code and better single responsibility principle for validators.
Updated DeviceValidator to handle new device verification, behind a feature flag.
Moved IDeviceValidator interface to separate file.
Updated CustomRequestValidator to act as the conduit by which *Validators communicate authentication context between themselves and the RequestValidators.
Adding new test for DeviceValidator class.
Updated tests for BaseRequestValidator as some functionality was moved to the DeviceValidator class.
GetByToken and GetMasterPasswordPolicy endpoints provide policy information, so if the organization is not using policies, then we avoid the rest of the logic.
* Add SQL files
* Add SQL Server migration
* Add Core entity
* Add Dapper repository
* Add EF repository
* Add EF migrations
* Save OrganizationInstallation during GetLicense invocation
* Run dotnet format
* Implement UserLeaveAsync in IRemoveOrganizationUserCommand and refactor OrganizationsController to use it
* Edit summary message for IRemoveOrganizationUserCommand.UserLeaveAsync
* Refactor RemoveOrganizationUserCommand.RemoveUsersAsync to log in bulk
---------
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
* Revoking users when enabling single org and 2fa policies. Fixing tests.
* Added migration.
* Wrote tests and fixed bugs found.
* Patch build process
* Fixing tests.
* Added unit test around disabling the feature flag.
* Updated error message to be public and added test for validating the request.
* formatting
* Added some tests for single org policy validator.
* Fix issues from merge.
* Added sending emails to revoked non-compliant users.
* Fixing name. Adding two factor policy email.
* Send email when user has been revoked.
* Correcting migration name.
* Fixing templates and logic issue in Revoke command.
* Moving interface into its own file.
* Correcting namespaces for email templates.
* correcting logic that would not allow normal users to revoke non owners.
* Actually correcting the test and logic.
* dotnet format. Added exec to bottom of bulk sproc
* Update src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/RevokeNonCompliantOrganizationUserCommand.cs
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
* Updated OrgIds to be a json string
* Fixing errors.
* Updating test
* Moving command result.
* Formatting and request rename
* Realized this would throw a null error from the system domain verification. Adding unknown type to event system user. Adding optional parameter to SaveAsync in policy service in order to pass in event system user.
* Code review changes
* Removing todos
* Corrected test name.
* Syncing filename to record name.
* Fixing up the tests.
* Added happy path test
* Naming corrections. And corrected EF query.
* added check against event service
* Code review changes.
* Fixing tests.
* splitting up tests
* Added templates and email side effect for claiming a domain.
* bringing changes from nc user changes.
* Switched to enqueue mail message.
* Filled in DomainClaimedByOrganization.html.hbs
* Added text document for domain claiming
* Fixing migration script.
* Remove old sproc
* Limiting sending of the email down to users who are a part of the domain being claimed.
* Added test for change
* Renames and fixed up email.
* Fixing up CSS
---------
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
Co-authored-by: Rui Tome <rtome@bitwarden.com>
* Added the ability to create a JWT on an organization license that contains all license properties as claims
* Added the ability to create a JWT on a user license that contains all license properties as claims
* Added ability to consume JWT licenses
* Resolved generic type issues when getting claim value
* Now validating the jwt signature, exp, and iat
* Moved creation of ClaimsPrincipal outside of licenses given dependecy on cert
* Ran dotnet format. Resolved identity error
* Updated claim types to use string constants
* Updated jwt expires to be one year
* Fixed bug requiring email verification to be on the token
* dotnet format
* Patch build process
---------
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
* Enhance RemoveOrganizationUserCommand to block removing managed users when account deprovisioning is enabled
* Refactor RemoveUsersAsync method to return just the OrgUserId and update related logic.
* Refactor RemoveOrganizationUserCommand to improve variable naming and remove unused logging method
* Add support for event system user in RemoveUsersAsync method. Refactor unit tests.
* Add xmldoc to IRemoveOrganizationUserCommand methods
* Refactor RemoveOrganizationUserCommand to use TimeProvider for event date retrieval and update unit tests accordingly
* Refactor RemoveOrganizationUserCommand to use constants for error messages
* Refactor unit tests to separate feature flag tests
* refactor: Update parameter names for clarity in RemoveOrganizationUserCommand
* refactor: Rename validation and repository methods for user removal clarity
- Revoking users when enabling single org and 2fa policies.
- Updated emails sent when users are revoked via 2FA or Single Organization policy enablement
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com>
1. Remove _organizationService.ValidateOrganizationUserUpdatePermissions since it is not needed for updating group associations.
2. Remove loggedInUserId since it's no longer needed.
3. Update/remove related tests.
refactor(TwoFactorAuthentication): Remove references to old Duo SDK version 2 code and replace them with the Duo SDK version 4 supported library DuoUniversal code.
Increased unit test coverage in the Two Factor Authentication code space. We opted to use DI instead of Inheritance for the Duo and OrganizaitonDuo two factor tokens to increase testability, since creating a testing mock of the Duo.Client was non-trivial.
Reviewed-by: @JaredSnider-Bitwarden
* Remove flag from CreateProviderCommand
* Remove flag from OrganizationsController
* Consolidate provider extensions
* Remove flag from ProvidersController
* Remove flag from CreateMsp.cshtml
* Remove flag from Provider Edit.cshtml
Also ensured the editable Gateway fields show for Multi-organization enterprises
* Remove flag from OrganizationsController
* Remove flag from billing-owned provider controllers
* Remove flag from OrganizationService
* Remove flag from RemoveOrganizationFromProviderCommand
* Remove flag from ProviderService
* Remove flag
* Run dotnet format
* Fix failing tests
* 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 PasswordHealthReportApplication Entities and Repos
* PM-13236 moved files under tools from core
* PM-13236 Entity PasswordHealthReportApplication namespace changed to tools/entities
* PM-13236 moved Repos and Interfaces to tools
* PM-13236 migrated model to tools namespace
* PM-13236 minor fixes to the unit tests
* PM-13236 fixed script errors during build
* PM-13236 Script to drop PasswordHealthReportApplications if it exists
* PM-13236 fixes to database snapshot
* PM-13236 updated databasesnapshots
* PM-13236 Update database model changes for Mysql
* PM-13236 update model changes for Sqlite
* PM-13236 updated the models to remove commented code
* PM-13236 added correct db snapshot for MySql
* PM-13236 updated database snapshot for Postgres
* PM-13236 updated database snapshot for Sqlite
* PM-13236 removed unwanted directive to fix linting error
* PM-13236 removed redundant script files
* PM-13237 Add entity command and unit tests
* PM-13237 Get query added with unit tests
* PM-13237 Controller to add/get PasswordHealthReportApplication
* PM-13237 Setup dependencies in the EF Service collection extensions
* PM-13237 Added unit tests for ReportsController
* Adding CanToggleState to PoliciesControllers (api/public) endpoints. Added mappings wrapped in feature flag.
* Updated logic for determining CanToggle. Removed setting of toggle from List endpoint. Added new details model for single policy response. Validator now returns after first error.
* 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 PasswordHealthReportApplication Entities and Repos
* PM-13236 moved files under tools from core
* PM-13236 Entity PasswordHealthReportApplication namespace changed to tools/entities
* PM-13236 moved Repos and Interfaces to tools
* PM-13236 migrated model to tools namespace
* PM-13236 minor fixes to the unit tests
* PM-13236 fixed script errors during build
* PM-13236 Script to drop PasswordHealthReportApplications if it exists
* PM-13236 fixes to database snapshot
* PM-13236 updated databasesnapshots
* PM-13236 Update database model changes for Mysql
* PM-13236 update model changes for Sqlite
* PM-13236 updated the models to remove commented code
* PM-13236 added correct db snapshot for MySql
* PM-13236 updated database snapshot for Postgres
* PM-13236 updated database snapshot for Sqlite
* PM-13236 removed unwanted directive to fix linting error
* PM-13236 removed redundant script files
* Add check for managed user before purging account
* Rename IOrganizationRepository.GetByClaimedUserDomainAsync to GetByVerifiedUserEmailDomainAsync and refactor to return a list. Remove ManagedByOrganizationId from ProfileResponseMode. Add ManagesActiveUser to ProfileOrganizationResponseModel
* Rename the property ManagesActiveUser to UserIsManagedByOrganization
* Remove whole class #nullable enable and add it to specific places
* [PM-11405] Account Deprovisioning: Prevent a verified user from changing their email address
* Remove unnecessary .ToList()
* Refactor IUserService methods GetOrganizationsManagingUserAsync and IsManagedByAnyOrganizationAsync to not return nullable objects. Update ProfileOrganizationResponseModel.UserIsManagedByOrganization to not be nullable
* Prevent deletion of accounts managed by an organization when Account Deprovisioning is enabled
* Add CannotDeleteManagedAccountViewModel and email templates
- Added CannotDeleteManagedAccountViewModel class to handle emails related to preventing deletion of accounts managed by an organization.
- Added HTML and text email templates for sending notifications about the inability to delete an account owned by an organization.
- Updated IMailService interface with a new method to send the cannot delete managed account email.
- Implemented the SendCannotDeleteManagedAccountEmailAsync method in HandlebarsMailService.
- Added a check in UserService to send the cannot delete managed account email if the user is managed by any organization.
- Added a no-op implementation for SendCannotDeleteManagedAccountEmailAsync in NoopMailService.
* Update error message when unable to purge vault for managed account
* Update error message when unable to change email for managed account
* Update error message when unable to delete account when managed by organization
* Update error message in test for deleting organization-owned accounts
* changes to include subscription status metadata
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Fix the failing test
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Resolve the failing test
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
---------
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
* Add delete permission to cs role
* Add domain verification stat to portal
* add feature flag and unit tests
* fix test
* Refactor from PR feedback
* update comment
* Return Policy object instead of NotFoundException
* Add unit tests, change orgId type to Guid
* Fix test cases, throw exception when manage not allowed