1
0
mirror of https://github.com/bitwarden/server synced 2026-01-05 01:53:17 +00:00

Billing/pm 27217/update secrets manager test fix (#6478)

* fix(billing): Add comments for clarity

* fix(billing): Update generated properties for test
This commit is contained in:
Stephon Brown
2025-10-22 13:42:56 -04:00
committed by GitHub
parent f82125f416
commit 0a7e6ae3ca
2 changed files with 35 additions and 18 deletions

View File

@@ -226,7 +226,11 @@ public class UpdateSecretsManagerSubscriptionCommand : IUpdateSecretsManagerSubs
// Check minimum seats currently in use by the organization
if (organization.SmSeats.Value > update.SmSeats.Value)
{
// Retrieve the number of currently occupied Secrets Manager seats for the organization.
var occupiedSeats = await _organizationUserRepository.GetOccupiedSmSeatCountByOrganizationIdAsync(organization.Id);
// Check if the occupied number of seats exceeds the updated seat count.
// If so, throw an exception indicating that the subscription cannot be decreased below the current usage.
if (occupiedSeats > update.SmSeats.Value)
{
throw new BadRequestException($"{occupiedSeats} users are currently occupying Secrets Manager seats. " +
@@ -412,7 +416,7 @@ public class UpdateSecretsManagerSubscriptionCommand : IUpdateSecretsManagerSubs
}
/// <summary>
/// Requests the number of Secret Manager seats and service accounts are currently used by the organization
/// Requests the number of Secret Manager seats and service accounts currently used by the organization
/// </summary>
/// <param name="organizationId"> The id of the organization</param>
/// <returns > A tuple containing the occupied seats and the occupied service account counts</returns>