1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-10 07:38:13 -05:00

81 Commits

Author SHA1 Message Date
jrmccannon
ad3131f66e
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. 2025-03-26 10:56:33 -05:00
jrmccannon
f3f2f41cfb
Merge branch 'refs/heads/main' into jmccannon/ac/pm-16811-scim-invite-optimization
# Conflicts:
#	test/Core.Test/AdminConsole/Services/OrganizationServiceTests.cs
2025-03-26 10:41:50 -05:00
Rui Tomé
f04a3d638b
[PM-18235] Add PersonalOwnershipPolicyRequirement (#5439)
* Add PersonalOwnershipPolicyRequirement for managing personal ownership policy

* Add tests for PersonalOwnershipPolicyRequirement

* Register PersonalOwnershipPolicyRequirement in policy requirement factory

* Update ImportCiphersCommand to check PersonalOwnershipPolicyRequirement if the PolicyRequirements flag is enabled

Update unit tests

* Update CipherService to support PersonalOwnershipPolicyRequirement with feature flag

- Add support for checking personal ownership policy using PolicyRequirementQuery when feature flag is enabled
- Update CipherService constructor to inject new dependencies
- Add tests for personal vault restrictions with and without feature flag

* Clean up redundant "Arrange", "Act", and "Assert" comments in test methods

* Refactor PersonalOwnershipPolicyRequirementTests method names for clarity

- Improve test method names to better describe their purpose and behavior
- Rename methods to follow a more descriptive naming convention
- No functional changes to the test logic

* Remove commented code explaining policy check

* Refactor PersonalOwnership Policy Requirement implementation

- Add PersonalOwnershipPolicyRequirementFactory to replace static Create method
- Simplify policy requirement creation logic
- Update PolicyServiceCollectionExtensions to register new factory
- Update ImportCiphersCommand to use correct user ID parameter
- Remove redundant PersonalOwnershipPolicyRequirementTests

* Remove redundant PersonalOwnershipPolicyRequirementTests

* Remove unnecessary tests from PersonalOwnershipPolicyRequirementFactoryTests
2025-03-26 09:40:13 +00:00
jrmccannon
6c6ecfefdf
Fixing name. 2025-03-24 15:32:30 -05:00
jrmccannon
038c00d21f
PasswordManagerInviteUserValidation to PasswordManagerInviteUserValidator 2025-03-24 12:39:03 -05:00
jrmccannon
f0770eda93
Rename for InvitingUserOrganizationValidation to InvitingUserOrganizationValidator 2025-03-24 12:35:16 -05:00
jrmccannon
982611bd1b
Renamed InviteUsersValidation to InviteUsersValidator 2025-03-24 12:34:36 -05:00
Rui Tomé
24b63f2dcd
[PM-12493] Extract ConfirmUser methods from OrganizationService into commands (#5505)
* 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
2025-03-24 17:05:46 +00:00
jrmccannon
7be2e2bd07
Removed test only constructor from InviteOrganization 2025-03-24 08:45:19 -05:00
jrmccannon
3f81e15169
fixed test 2025-03-21 15:54:03 -05:00
jrmccannon
87c181b662
Refactor validation parameter to improve clarity and consistency. Added XML doc 2025-03-21 15:18:05 -05:00
jrmccannon
d867b47705
Merge branch 'refs/heads/main' into jmccannon/ac/pm-16811-scim-invite-optimization
# Conflicts:
#	src/Core/AdminConsole/Services/Implementations/OrganizationService.cs
2025-03-21 13:50:22 -05:00
Brandon Treston
c7c6528faa
Ac/pm 18240 implement policy requirement for reset password policy (#5521)
* wip

* fix test

* fix test

* refactor

* fix factory method and tests

* cleanup

* refactor

* update copy

* cleanup
2025-03-21 10:07:55 -04:00
jrmccannon
829e49c398
Fixed tests. 2025-03-20 09:11:09 -05:00
jrmccannon
59b579f071
Refactored to use new ValidationResult pattern. added mapping method. 2025-03-17 13:27:37 -05:00
jrmccannon
813333e9bb
Merge branch 'main' into jmccannon/ac/pm-16811-scim-invite-optimization
# Conflicts:
#	src/Core/Models/Commands/CommandResult.cs
2025-03-17 08:59:17 -05:00
Thomas Rittson
224ef1272e
[PM-18876] Refine PolicyRequirements API (#5445)
* make the PolicyRequirements API more granular, e.g.
  replace factory methods with a factory interface
* update Send to use the new API
2025-03-11 10:46:09 +10:00
jrmccannon
d8264a9085
Fixed some changes. 2025-03-07 14:43:12 -06:00
jrmccannon
e4aa740a28
Fixed some compilation errors. 2025-03-07 12:46:59 -06:00
jrmccannon
4317276f5d
Dto rename. Moved from static methods to ctors 2025-03-07 10:03:47 -06:00
jrmccannon
56c7cc8bf4
Rename of OrgDto 2025-03-05 16:21:40 -06:00
jrmccannon
f8c08de2db
Merge branch 'main' into jmccannon/ac/pm-16811-scim-invite-optimization
# Conflicts:
#	src/Core/AdminConsole/Services/Implementations/OrganizationService.cs
#	test/Infrastructure.IntegrationTest/AdminConsole/Repositories/OrganizationUserRepositoryTests.cs
2025-03-05 15:24:13 -06:00
jrmccannon
c7cc9527f4
Moved FromOrganization mapper method to a constructor 2025-03-05 15:04:50 -06:00
jrmccannon
611ad8c343
Moved to private method. Made ScimInvite inherit the single invite base model. Moved create methods to constructors. A few more CR changes included. 2025-03-05 14:55:41 -06:00
jrmccannon
4ff27fd668
created response model and split interface out. 2025-03-05 07:42:09 -06:00
Alex Morask
a2e665cb96
[PM-16684] Integrate Pricing Service behind FF (#5276)
* Remove gRPC and convert PricingClient to HttpClient wrapper

* Add PlanType.GetProductTier extension

Many instances of StaticStore use are just to get the ProductTierType of a PlanType, but this can be derived from the PlanType itself without having to fetch the entire plan.

* Remove invocations of the StaticStore in non-Test code

* Deprecate StaticStore entry points

* Run dotnet format

* Matt's feedback

* Run dotnet format

* Rui's feedback

* Run dotnet format

* Replacements since approval

* Run dotnet format
2025-02-27 07:55:46 -05:00
Rui Tomé
d15c1faa74
[PM-12491] Create Organization disable command (#5348)
* Add command interface and implementation for disabling organizations

* Register organization disable command for dependency injection

* Add unit tests for OrganizationDisableCommand

* Refactor subscription handlers to use IOrganizationDisableCommand for disabling organizations

* Remove DisableAsync method from IOrganizationService and its implementation in OrganizationService

* Remove IOrganizationService dependency from SubscriptionDeletedHandler

* Remove commented TODO for sending email to owners in OrganizationDisableCommand
2025-02-25 14:57:30 +00:00
jrmccannon
001a5dea86
Added integration test around enabling feature and sending invite via scim. Did a bit of refactoring on the SM validation. Fixed couple bugs found. 2025-02-24 11:10:48 -06:00
Thomas Rittson
b0c6fc9146
[PM-18234] Add SendPolicyRequirement (#5409) 2025-02-24 09:19:52 +10:00
jrmccannon
bd5189491e
Added more tests for the updates 2025-02-21 16:08:07 -06:00
jrmccannon
1dbe37a250
Added test to verify valid request with a user calls db method and sends the invite 2025-02-21 15:09:17 -06:00
jrmccannon
e10b7cc78f
First test of new command. 2025-02-21 12:04:11 -06:00
jrmccannon
6ec850e384
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
2025-02-21 09:15:41 -06:00
jrmccannon
649e8b5c0a
Merge branch 'main' into jmccannon/ac/pm-16811-scim-invite-optimization
# Conflicts:
#	src/Core/Constants.cs
2025-02-17 16:35:02 -06:00
jrmccannon
926e786f82
Added bulk procedure for saving users, collections and groups from inviting. Added test to validate Ef and Sproc 2025-02-17 16:32:23 -06:00
Rui Tomé
f4c37df883
[PM-12490] Extract OrganizationService.EnableAsync into commands (#5321)
* Add organization enable command implementation

* Add unit tests for OrganizationEnableCommand

* Add organization enable command registration for dependency injection

* Refactor payment and subscription handlers to use IOrganizationEnableCommand for organization enabling

* Remove EnableAsync methods from IOrganizationService and OrganizationService

* Add xmldoc to IOrganizationEnableCommand

* Refactor OrganizationEnableCommand to consolidate enable logic and add optional expiration
2025-02-14 11:25:29 +00:00
Thomas Rittson
f4341b2f3b
[PM-14439] Add PolicyRequirementQuery for enforcement logic (#5336)
* Add PolicyRequirementQuery, helpers and models in preparation for migrating domain code

Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
2025-02-14 11:05:49 +00:00
jrmccannon
fcaa449f83
Added Secrets Manager Validations and Tests. 2025-02-13 16:23:00 -06:00
jrmccannon
bf8d6fb3ba
Added plan validation to PasswordManagerInviteUserValidation. Cleaned up a few things. 2025-02-13 10:33:20 -06:00
jrmccannon
4b6eba4523
WIP changes for Invite User optimization from Scim 2025-02-12 11:30:00 -06:00
Rui Tomé
3908edd08f
[PM-12489] Extract OrganizationService.DeleteAsync and OrganizationService.InitiateDeleteAsync into commands (#5279)
* Create organization deletion command with logic extracted from OrganizationService

* Add unit tests for OrganizationDeleteCommand

* Register OrganizationDeleteCommand for dependency injection

* Refactor organization deletion logic to use IOrganizationDeleteCommand and remove legacy IOrganizationService.DeleteAsync method

* Add organization deletion initiation command and refactor service usage

* Enhance organization deletion commands with detailed XML documentation

* Refactor organization command registration to include sign-up and deletion methods
2025-01-27 10:58:08 +00:00
Alex Morask
f140c7f6c1
[PM-11730] Remove feature flag: AC-2476-deprecate-stripe-sources-api (#5201)
* Removed feature flag

* Run dotnet format

* Fix integration tests
2025-01-24 13:38:35 -05:00
Rui Tomé
edb74add50
[PM-14243] Free organization limit is not enforced when editing user (#5155)
* 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
2025-01-21 10:15:02 +00:00
Jared McCannon
730f83b425
Fixing misspelling. made changes to domain claim email. (#5248) 2025-01-10 14:19:52 -06:00
Rui Tomé
fbfabf2651
[PM-15547] Fix two-factor authentication revocation logic and update related tests (#5246)
* Fix two-factor authentication revocation logic and update related tests

* Refine test for RevokeNonCompliantOrganizationUserCommand to assert single user revocation
2025-01-10 14:45:09 +00:00
Jared McCannon
fd195e7cf3
Forgot to remove compliant users from the list. (#5241) 2025-01-09 14:13:29 -06:00
Jared McCannon
e754ae4729
[PM-10319] - Send 2FA Email when policy enabled (#5233)
* Correcting which email is sent when enabling 2FA policy.

* Fixing the test.
2025-01-09 09:35:40 -06:00
Ike
a84ef0724c
[PM-15614] Allow Users to opt out of new device verification (#5176)
feat(NewDeviceVerification) : 
* Created database migration scripts for VerifyDevices column in [dbo].[User].
* Updated DeviceValidator to check if user has opted out of device verification.
* Added endpoint to AccountsController.cs to allow editing of new User.VerifyDevices property.
* Added tests for new methods and endpoint.
* Updating queries to track [dbo].[User].[VerifyDevices].
* Updated DeviceValidator to set `User.EmailVerified` property during the New Device Verification flow.
2025-01-08 07:31:24 -08:00
Rui Tomé
b75c63c2c6
[PM-15957] Fix: Domain Claim fails to enable Single Organization Policy, sends no emails and Revokes all users (#5147)
* Add JSON-based stored procedure for updating account revision dates and modify existing procedure to use it

* Refactor SingleOrgPolicyValidator to revoke only non-compliant organization users and update related tests
2024-12-17 15:57:31 +00:00
Rui Tomé
127f1fd34d
[PM-10338] Update the Organization 'Leave' endpoint to log EventType.OrganizationUser_Left (#4908)
* 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>
2024-12-10 11:14:34 +00:00