From 58c386460104c3792446a8b013d5ab674cd520a6 Mon Sep 17 00:00:00 2001 From: jrmccannon Date: Mon, 31 Mar 2025 10:10:54 -0500 Subject: [PATCH] Rearranged some things. Fixed the tests. --- bitwarden_license/src/Scim/Users/PostUserCommand.cs | 3 ++- .../InviteUsersPasswordManagerValidator.cs | 10 +++++----- .../PasswordManagerInviteUserValidatorTests.cs | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bitwarden_license/src/Scim/Users/PostUserCommand.cs b/bitwarden_license/src/Scim/Users/PostUserCommand.cs index a0e694aa0e..288e2eae2b 100644 --- a/bitwarden_license/src/Scim/Users/PostUserCommand.cs +++ b/bitwarden_license/src/Scim/Users/PostUserCommand.cs @@ -60,7 +60,8 @@ public class PostUserCommand( var request = model.ToRequest( scimProvider: scimProvider, inviteOrganization: new InviteOrganization(organization, plan), - performedAt: timeProvider.GetUtcNow()); + performedAt: timeProvider.GetUtcNow(), + hasSecretsManagerStandalone); var orgUsers = await organizationUserRepository .GetManyDetailsByOrganizationAsync(request.InviteOrganization.OrganizationId); diff --git a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/PasswordManager/InviteUsersPasswordManagerValidator.cs b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/PasswordManager/InviteUsersPasswordManagerValidator.cs index 189645e594..1867a2808e 100644 --- a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/PasswordManager/InviteUsersPasswordManagerValidator.cs +++ b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/PasswordManager/InviteUsersPasswordManagerValidator.cs @@ -34,16 +34,16 @@ public class InviteUsersPasswordManagerValidator( return new Valid(subscriptionUpdate); } + if (subscriptionUpdate.SeatsRequiredToAdd == 0) + { + return new Valid(subscriptionUpdate); + } + if (subscriptionUpdate.PasswordManagerPlan.BaseSeats + subscriptionUpdate.SeatsRequiredToAdd <= 0) { return new Invalid(new PasswordManagerMustHaveSeatsError(subscriptionUpdate)); } - if (subscriptionUpdate.NewUsersToAdd == 0) - { - return new Valid(subscriptionUpdate); - } - if (subscriptionUpdate.MaxSeatsReached) { return new Invalid( diff --git a/test/Core.Test/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/PasswordManagerInviteUserValidatorTests.cs b/test/Core.Test/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/PasswordManagerInviteUserValidatorTests.cs index 1d0c3ced2a..c320ada8cb 100644 --- a/test/Core.Test/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/PasswordManagerInviteUserValidatorTests.cs +++ b/test/Core.Test/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/PasswordManagerInviteUserValidatorTests.cs @@ -75,7 +75,7 @@ public class InviteUsersPasswordManagerValidatorTests public async Task Validate_GivenThePlanDoesNotAllowAdditionalSeats_ShouldBeInvalidMessageOfPlanNotAllowingSeats(Organization organization, SutProvider sutProvider) { - organization.Seats = 8; + organization.Seats = 4; organization.MaxAutoscaleSeats = 9; var seatsOccupiedByUsers = 4; var additionalSeats = 4;