1
0
mirror of https://github.com/bitwarden/server synced 2026-01-07 02:53:38 +00:00

Updated LicensingService to be a singleton again and moved IFeatureService up a frame in the call stack (#5238)

This commit is contained in:
Conner Turnbull
2025-01-09 12:40:16 -05:00
committed by GitHub
parent 28d5535010
commit 6771f79597
4 changed files with 33 additions and 19 deletions

View File

@@ -15,17 +15,20 @@ public class CloudGetOrganizationLicenseQuery : ICloudGetOrganizationLicenseQuer
private readonly IPaymentService _paymentService;
private readonly ILicensingService _licensingService;
private readonly IProviderRepository _providerRepository;
private readonly IFeatureService _featureService;
public CloudGetOrganizationLicenseQuery(
IInstallationRepository installationRepository,
IPaymentService paymentService,
ILicensingService licensingService,
IProviderRepository providerRepository)
IProviderRepository providerRepository,
IFeatureService featureService)
{
_installationRepository = installationRepository;
_paymentService = paymentService;
_licensingService = licensingService;
_providerRepository = providerRepository;
_featureService = featureService;
}
public async Task<OrganizationLicense> GetLicenseAsync(Organization organization, Guid installationId,
@@ -38,11 +41,13 @@ public class CloudGetOrganizationLicenseQuery : ICloudGetOrganizationLicenseQuer
}
var subscriptionInfo = await GetSubscriptionAsync(organization);
return new OrganizationLicense(organization, subscriptionInfo, installationId, _licensingService, version)
var license = new OrganizationLicense(organization, subscriptionInfo, installationId, _licensingService, version);
if (_featureService.IsEnabled(FeatureFlagKeys.SelfHostLicenseRefactor))
{
Token = await _licensingService.CreateOrganizationTokenAsync(organization, installationId, subscriptionInfo)
};
license.Token = await _licensingService.CreateOrganizationTokenAsync(organization, installationId, subscriptionInfo);
}
return license;
}
private async Task<SubscriptionInfo> GetSubscriptionAsync(Organization organization)