1
0
mirror of https://github.com/bitwarden/server synced 2025-12-29 14:43:39 +00:00

[PM-21257] Revert MaxProjects license changes, limit MaxProjectsQuery to cloud-only for 2-person organizations (#5776)

* Revert "Add SmMaxProjects to OrganizationLicense (#5678)"

This reverts commit 7fe022e26f.

* Use PricingClient in MaxProjectsQuery and limit to cloud-only (free 2-person)
This commit is contained in:
Alex Morask
2025-05-13 08:51:36 -04:00
committed by GitHub
parent a1b22e66e5
commit 082bfa3c6a
10 changed files with 38 additions and 229 deletions

View File

@@ -1,6 +1,5 @@
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Billing.Pricing;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
using Bit.Core.Models.Business;
@@ -17,22 +16,19 @@ public class CloudGetOrganizationLicenseQuery : ICloudGetOrganizationLicenseQuer
private readonly ILicensingService _licensingService;
private readonly IProviderRepository _providerRepository;
private readonly IFeatureService _featureService;
private readonly IPricingClient _pricingClient;
public CloudGetOrganizationLicenseQuery(
IInstallationRepository installationRepository,
IPaymentService paymentService,
ILicensingService licensingService,
IProviderRepository providerRepository,
IFeatureService featureService,
IPricingClient pricingClient)
IFeatureService featureService)
{
_installationRepository = installationRepository;
_paymentService = paymentService;
_licensingService = licensingService;
_providerRepository = providerRepository;
_featureService = featureService;
_pricingClient = pricingClient;
}
public async Task<OrganizationLicense> GetLicenseAsync(Organization organization, Guid installationId,
@@ -46,11 +42,7 @@ public class CloudGetOrganizationLicenseQuery : ICloudGetOrganizationLicenseQuer
var subscriptionInfo = await GetSubscriptionAsync(organization);
var license = new OrganizationLicense(organization, subscriptionInfo, installationId, _licensingService, version);
var plan = await _pricingClient.GetPlan(organization.PlanType);
int? smMaxProjects = plan?.SupportsSecretsManager ?? false
? plan.SecretsManager.MaxProjects
: null;
license.Token = await _licensingService.CreateOrganizationTokenAsync(organization, installationId, subscriptionInfo, smMaxProjects);
license.Token = await _licensingService.CreateOrganizationTokenAsync(organization, installationId, subscriptionInfo);
return license;
}