* Renamed ManagedUserDomainClaimedEmails to ClaimedUserDomainClaimedEmails
* Renamed method to improve clarity and consistency.
Replaced `ValidateManagedUserDomainAsync` with `ValidateClaimedUserDomainAsync`.
* Rename `GetOrganizationsManagingUserAsync` to `GetOrganizationsClaimingUserAsync`.
This renaming clarifies the function's purpose, aligning its name with the concept of "claiming" rather than "managing" user associations.
* Refactor variable naming in ValidateClaimedUserDomainAsync
* Managed to claimed
* Managed to claimed
* Managed to claimed
* Managing to Claiming
* Managing to Claiming
* Managing to Claiming
* Managing to Claiming
* Renamed DeleteManagedOrganizationUserAccountCommand to DeleteClaimedOrganizationUserAccountCommand
* Renamed IDeleteManagedOrganizationUserAccountCommand to IDeleteClaimedOrganizationUserAccountCommand
* Updated variable name
* IsManagedBy to IsClaimedBy
* Created new property. obsoleted old property and wired up for backward compatibility.
* More Managed to Claimed renames.
* Managed to Claimed
* Fixing tests... 🤦
* Got the rest of em
* missed the test 🤦
* fixed test.
* WIP changes for Invite User optimization from Scim
* feature flag string
* Added plan validation to PasswordManagerInviteUserValidation. Cleaned up a few things.
* Added Secrets Manager Validations and Tests.
* Added bulk procedure for saving users, collections and groups from inviting. Added test to validate Ef and Sproc
* Created SendOrganizationInvitesCommand and moved some tests from OrgServiceTests. Fixed some tests in org service in relation to moving out SendOrgInviteCommand code.
Added side effects to InviteOrganizationUsersCommand
* First test of new command.
* Added test to verify valid request with a user calls db method and sends the invite
* Added more tests for the updates
* Added integration test around enabling feature and sending invite via scim. Did a bit of refactoring on the SM validation. Fixed couple bugs found.
* Switching over to a local factory.
* created response model and split interface out.
* switched to initialization block
* Moved to private method. Made ScimInvite inherit the single invite base model. Moved create methods to constructors. A few more CR changes included.
* Moved `FromOrganization` mapper method to a constructor
* Updated to use new pricing client. Supressed null dereference errors.
* Fixing bad merge.
* Rename of OrgDto
* undoing this
* Moved into class
* turned into a switch statement
* Separated into separate files.
* Renamed dto and added ctor
* Dto rename. Moved from static methods to ctors
* Removed unused request model
* changes from main
* missed value
* Fixed some compilation errors.
* Fixed some changes.
* Removed comment
* fixed compiler warning.
* Refactored to use new ValidationResult pattern. added mapping method.
* Added throwing of Failure as the previous implementation would have.
* Cleaned up return.
* fixing test.
* Made HasSecretsManagerStandalone return if org doesn't have sm. Added overload for lighter weight model and moved common code to private method.
* Fixed tests.
* Made public method private. added some comments.
* Refactor validation parameter to improve clarity and consistency. Added XML doc
* fixed test
* Removed test only constructor from InviteOrganization
* Separated old and new code explicitly. Moved old code checks down into new code as well. Added error and mapper to Failure<T>
* Variable/Field/Property renames
* Renamed InviteUsersValidation to InviteUsersValidator
* Rename for InvitingUserOrganizationValidation to InvitingUserOrganizationValidator
* PasswordManagerInviteUserValidation to PasswordManagerInviteUserValidator
* Moved XML comment. Added check to see if additional seats are needed.
* Fixing name.
* Updated names.
* Corrected double negation.
* Added groups and collection and users checks.
* Fixed comment. Fixed multiple enumeration. Changed variable name.
* Cleaned up DTO models. Moved some validation steps around. A few quick fixes to address CR concerns. Still need to move a few things yet.
* Fixed naming in subscription update models.
* put back in the request for now.
* Quick rename
* Added provider email addresses as well.
* Removed valid wrapper to pass in to validation methods.
* fix tests
* Code Review changes.
* Removed unused classes
* Using GetPlanOrThrow instead.
* Switches to extension method
* Made Revert and Adjust Sm methods consistent. Corrected string comparer. Added comment for revert sm.
* Fixing compiler complaint.
* Adding XML docs
* Calculated seat addition for SM.
* Fixing compiler complaints.
* Renames for organization.
* Fixing comparison issue.
* Adding error and aligning message.
* fixing name of method.
* Made extension method.
* Rearranged some things. Fixed the tests.
* Added test around validating the revert.
* Added test to validate the provider email is sent if org is managed by a provider.
* Created new errors and removed references in business code to ErrorMessages property. This aligns Invite User code to use Errors instead of ErrorMessages
* Delayed the hasSecretsManagerStandalone call as long as possible.
* Corrected model name. Corrected SM seat calculation. Added test for it.
* Corrected logic and added more tests.
* Refactor OrganizationService to remove feature flag check for PushSyncOrgKeysOnRevokeRestore
* Remove redundant tests
* Remove unused IFeatureService dependency from RestoreOrganizationUserCommand class
* Moved RestoreUserAsync and RestoreUsersAsync to Command.
* Fixing the bug.
* Added test for bulk method.
* Fixing sonar cube warning.
* SonarQube warning fix.
* Excluding org users we already have.
* Fixed misspelling. Added integration test for method.
* test had the misspelling as well 🤦
* Split out interface. Added admin and confirmed constraints.
* fixed queries and added xml comments and tests.
* Add ConfirmOrganizationUserCommand and IConfirmOrganizationUserCommand interface for managing organization user confirmations
* Add unit tests for ConfirmOrganizationUserCommand to validate user confirmation scenarios
* Register ConfirmOrganizationUserCommand for dependency injection
* Refactor OrganizationUsersController to utilize IConfirmOrganizationUserCommand for user confirmation processes
* Remove ConfirmUserAsync and ConfirmUsersAsync methods from IOrganizationService and OrganizationService
* Rename test methods in ConfirmOrganizationUserCommandTests for clarity and consistency
* Update test method name in ConfirmOrganizationUserCommandTests for improved clarity
* Enforce free organization limit when updating user
* Add test for throwing error on accepting admin user joining multiple free organizations
* Add test for throwing BadRequest when free organization admin attempts to sign up for another free organization
* Fix user ID handling in UpdateOrganizationUserCommand for free organizations
* Rename parameter 'user' to 'organizationUser' in UpdateUserAsync method for clarity
* Fix two-factor authentication revocation logic and update related tests
* Refine test for RevokeNonCompliantOrganizationUserCommand to assert single user revocation
* 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>
* 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>
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.
* Add HasConfirmedOwnersExceptQuery class, interface and unit tests
* Register IHasConfirmedOwnersExceptQuery for dependency injection
* Replace OrganizationService.HasConfirmedOwnersExceptAsync with HasConfirmedOwnersExceptQuery
* Refactor DeleteManagedOrganizationUserAccountCommand to use IHasConfirmedOwnersExceptQuery
* Fix unit tests
* Extract IOrganizationService.RemoveUserAsync into IRemoveOrganizationUserCommand; Update unit tests
* Extract IOrganizationService.RemoveUsersAsync into IRemoveOrganizationUserCommand; Update unit tests
* Refactor RemoveUserAsync(Guid organizationId, Guid userId) to use ValidateDeleteUser
* Refactor RemoveOrganizationUserCommandTests to use more descriptive method names
* Refactor controller actions to accept Guid directly instead of parsing strings
* Add unit tests for removing OrganizationUser by UserId
* Refactor remove OrganizationUser by UserId method
* Add summary to IHasConfirmedOwnersExceptQuery
* 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 new event types for organization user deletion and voluntary departure
* Add DeleteManagedOrganizationUserAccountCommand to remove user and delete account
* Refactor DeleteManagedOrganizationUserAccountCommand to use orgUser.Id instead of orgUser.UserId.Value
* Add DeleteManagedOrganizationUserAccountCommandTests
* Remove duplicate sql migration script
* Update DeleteManagedOrganizationUserAccountCommand methods to cover all existing checks on OrganizationService
* Add unit tests for all user checks
* Refactor DeleteManagedOrganizationUserAccountCommand
* Set nullable enable annotation on DeleteManagedOrganizationUserAccountCommand
* Fix possible null reference
* Refactor DeleteManagedOrganizationUserAccountCommand.cs for improved event logging
* Use UserRepository.GetByIdAsync instead of UserService.GetUserByIdAsync
* Refactor DeleteManagedOrganizationUserAccountCommand.cs for improved error messages
* Refactor DeleteManagedOrganizationUserAccountCommand.cs for improved event logging, error handling and reduce database calls
* Rename unit tests to correctly describe expected outcome
* 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.
* Rename IDeleteOrganizationUserCommand to IRemoveOrganizationUserCommand
* Rename IOrganizationService DeleteUser methods to RemoveUser
* Rename API endpoints for deleting organization users to "Remove"
* chore: Rename Delete method to Remove in MembersController
* chore: remove fc refs in CreateGroup and UpdateGroup commands, refs AC-2646
* chore: remove fc refs and update interface to represent usage/get rid of double enumeration warnings, refs AC-2646
* chore: remove org/provider service fc callers, refs AC-2646
* chore: remove collection service fc callers, refs AC-2646
* chore: remove cipher service import ciphers fc callers, refs AC-2646
* fix: UpdateOrganizationUserCommandTests collections to list, refs AC-2646
* fix: update CreateGroupCommandTests, refs AC-2646
* fix: adjust UpdateGroupCommandTests, refs AC-2646
* fix: adjust UpdateOrganizationUserCommandTests for FC always true, refs AC-2646
* fix: update CollectionServiceTests, refs AC-2646
* fix: remove unnecessary test with fc disabled, refs AC-2646
* fix: update tests to account for AccessAll removal and Manager removal, refs AC-2646
* chore: remove dependence on FC flag for tests, refs AC-2646
* [PM-3176] Extract IOrganizationService.SaveUserAsync to a command
* [PM-3176] Enabled nullable on command
* [PM-3176] Removed check that was not working
* 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