1
0
mirror of https://github.com/bitwarden/server.git synced 2025-03-12 13:29:14 +01:00

[PM-17594]Remove feature flag self-host license refactor (#5372)

* Remove the feature flag

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Resolve the failing test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

---------

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com>
This commit is contained in:
cyprain-okeke 2025-03-10 11:46:44 +01:00 committed by GitHub
parent f26f14165c
commit 88e91734f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 3 additions and 12 deletions

View File

@ -155,7 +155,6 @@ public static class FeatureFlagKeys
public const string MacOsNativeCredentialSync = "macos-native-credential-sync"; public const string MacOsNativeCredentialSync = "macos-native-credential-sync";
public const string PM9111ExtensionPersistAddEditForm = "pm-9111-extension-persist-add-edit-form"; public const string PM9111ExtensionPersistAddEditForm = "pm-9111-extension-persist-add-edit-form";
public const string InlineMenuTotp = "inline-menu-totp"; public const string InlineMenuTotp = "inline-menu-totp";
public const string SelfHostLicenseRefactor = "pm-11516-self-host-license-refactor";
public const string PrivateKeyRegeneration = "pm-12241-private-key-regeneration"; public const string PrivateKeyRegeneration = "pm-12241-private-key-regeneration";
public const string AppReviewPrompt = "app-review-prompt"; public const string AppReviewPrompt = "app-review-prompt";
public const string ResellerManagedOrgAlert = "PM-15814-alert-owners-of-reseller-managed-orgs"; public const string ResellerManagedOrgAlert = "PM-15814-alert-owners-of-reseller-managed-orgs";

View File

@ -42,10 +42,7 @@ public class CloudGetOrganizationLicenseQuery : ICloudGetOrganizationLicenseQuer
var subscriptionInfo = await GetSubscriptionAsync(organization); var subscriptionInfo = await GetSubscriptionAsync(organization);
var license = new OrganizationLicense(organization, subscriptionInfo, installationId, _licensingService, version); var license = new OrganizationLicense(organization, subscriptionInfo, installationId, _licensingService, version);
if (_featureService.IsEnabled(FeatureFlagKeys.SelfHostLicenseRefactor))
{
license.Token = await _licensingService.CreateOrganizationTokenAsync(organization, installationId, subscriptionInfo); license.Token = await _licensingService.CreateOrganizationTokenAsync(organization, installationId, subscriptionInfo);
}
return license; return license;
} }

View File

@ -1218,10 +1218,7 @@ public class UserService : UserManager<User>, IUserService, IDisposable
? new UserLicense(user, _licenseService) ? new UserLicense(user, _licenseService)
: new UserLicense(user, subscriptionInfo, _licenseService); : new UserLicense(user, subscriptionInfo, _licenseService);
if (_featureService.IsEnabled(FeatureFlagKeys.SelfHostLicenseRefactor))
{
userLicense.Token = await _licenseService.CreateUserTokenAsync(user, subscriptionInfo); userLicense.Token = await _licenseService.CreateUserTokenAsync(user, subscriptionInfo);
}
return userLicense; return userLicense;
} }

View File

@ -56,7 +56,6 @@ public class CloudGetOrganizationLicenseQueryTests
sutProvider.GetDependency<IInstallationRepository>().GetByIdAsync(installationId).Returns(installation); sutProvider.GetDependency<IInstallationRepository>().GetByIdAsync(installationId).Returns(installation);
sutProvider.GetDependency<IPaymentService>().GetSubscriptionAsync(organization).Returns(subInfo); sutProvider.GetDependency<IPaymentService>().GetSubscriptionAsync(organization).Returns(subInfo);
sutProvider.GetDependency<ILicensingService>().SignLicense(Arg.Any<ILicense>()).Returns(licenseSignature); sutProvider.GetDependency<ILicensingService>().SignLicense(Arg.Any<ILicense>()).Returns(licenseSignature);
sutProvider.GetDependency<IFeatureService>().IsEnabled(FeatureFlagKeys.SelfHostLicenseRefactor).Returns(false);
var result = await sutProvider.Sut.GetLicenseAsync(organization, installationId); var result = await sutProvider.Sut.GetLicenseAsync(organization, installationId);
@ -64,7 +63,7 @@ public class CloudGetOrganizationLicenseQueryTests
Assert.Equal(organization.Id, result.Id); Assert.Equal(organization.Id, result.Id);
Assert.Equal(installationId, result.InstallationId); Assert.Equal(installationId, result.InstallationId);
Assert.Equal(licenseSignature, result.SignatureBytes); Assert.Equal(licenseSignature, result.SignatureBytes);
Assert.Null(result.Token); Assert.Equal(string.Empty, result.Token);
} }
[Theory] [Theory]
@ -77,7 +76,6 @@ public class CloudGetOrganizationLicenseQueryTests
sutProvider.GetDependency<IInstallationRepository>().GetByIdAsync(installationId).Returns(installation); sutProvider.GetDependency<IInstallationRepository>().GetByIdAsync(installationId).Returns(installation);
sutProvider.GetDependency<IPaymentService>().GetSubscriptionAsync(organization).Returns(subInfo); sutProvider.GetDependency<IPaymentService>().GetSubscriptionAsync(organization).Returns(subInfo);
sutProvider.GetDependency<ILicensingService>().SignLicense(Arg.Any<ILicense>()).Returns(licenseSignature); sutProvider.GetDependency<ILicensingService>().SignLicense(Arg.Any<ILicense>()).Returns(licenseSignature);
sutProvider.GetDependency<IFeatureService>().IsEnabled(FeatureFlagKeys.SelfHostLicenseRefactor).Returns(true);
sutProvider.GetDependency<ILicensingService>() sutProvider.GetDependency<ILicensingService>()
.CreateOrganizationTokenAsync(organization, installationId, subInfo) .CreateOrganizationTokenAsync(organization, installationId, subInfo)
.Returns(token); .Returns(token);