1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-04 12:40:22 -05:00

[PM-17593] Remove Multi-Org Enterprise feature flag (#5351)

This commit is contained in:
Jonas Hendrickx 2025-02-21 15:35:36 +01:00 committed by GitHub
parent 06c96a96c5
commit f6365fa385
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 22 additions and 102 deletions

View File

@ -3,7 +3,6 @@ using System.Net;
using Bit.Admin.AdminConsole.Models;
using Bit.Admin.Enums;
using Bit.Admin.Utilities;
using Bit.Core;
using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.Core.AdminConsole.Providers.Interfaces;
@ -133,11 +132,6 @@ public class ProvidersController : Controller
[HttpGet("providers/create/multi-organization-enterprise")]
public IActionResult CreateMultiOrganizationEnterprise(int enterpriseMinimumSeats, string ownerEmail = null)
{
if (!_featureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises))
{
return RedirectToAction("Create");
}
return View(new CreateMultiOrganizationEnterpriseProviderModel
{
OwnerEmail = ownerEmail,
@ -211,10 +205,6 @@ public class ProvidersController : Controller
}
var provider = model.ToProvider();
if (!_featureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises))
{
return RedirectToAction("Create");
}
await _createProviderCommand.CreateMultiOrganizationEnterpriseAsync(
provider,
model.OwnerEmail,

View File

@ -12,11 +12,6 @@
var providerTypes = Enum.GetValues<ProviderType>()
.OrderBy(x => x.GetDisplayAttribute().Order)
.ToList();
if (!FeatureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises))
{
providerTypes.Remove(ProviderType.MultiOrganizationEnterprise);
}
}
<h1>Create Provider</h1>

View File

@ -76,32 +76,29 @@
}
case ProviderType.MultiOrganizationEnterprise:
{
@if (FeatureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises) && Model.Provider.Type == ProviderType.MultiOrganizationEnterprise)
{
<div class="row">
<div class="col-sm">
<div class="mb-3">
@{
var multiOrgPlans = new List<PlanType>
{
PlanType.EnterpriseAnnually,
PlanType.EnterpriseMonthly
};
}
<label asp-for="Plan" class="form-label"></label>
<select class="form-control" asp-for="Plan" asp-items="Html.GetEnumSelectList(multiOrgPlans)">
<option value="">--</option>
</select>
</div>
</div>
<div class="col-sm">
<div class="mb-3">
<label asp-for="EnterpriseMinimumSeats" class="form-label"></label>
<input type="number" class="form-control" asp-for="EnterpriseMinimumSeats">
</div>
<div class="row">
<div class="col-sm">
<div class="mb-3">
@{
var multiOrgPlans = new List<PlanType>
{
PlanType.EnterpriseAnnually,
PlanType.EnterpriseMonthly
};
}
<label asp-for="Plan" class="form-label"></label>
<select class="form-control" asp-for="Plan" asp-items="Html.GetEnumSelectList(multiOrgPlans)">
<option value="">--</option>
</select>
</div>
</div>
}
<div class="col-sm">
<div class="mb-3">
<label asp-for="EnterpriseMinimumSeats" class="form-label"></label>
<input type="number" class="form-control" asp-for="EnterpriseMinimumSeats">
</div>
</div>
</div>
break;
}
}

View File

@ -150,7 +150,7 @@ public static class FeatureFlagKeys
public const string StorageReseedRefactor = "storage-reseed-refactor";
public const string TrialPayment = "PM-8163-trial-payment";
public const string RemoveServerVersionHeader = "remove-server-version-header";
public const string PM12275_MultiOrganizationEnterprises = "pm-12275-multi-organization-enterprises";
public const string GeneratorToolsModernization = "generator-tools-modernization";
public const string NewDeviceVerification = "new-device-verification";
public const string NewDeviceVerificationTemporaryDismiss = "new-device-temporary-dismiss";
public const string NewDeviceVerificationPermanentDismiss = "new-device-permanent-dismiss";

View File

@ -1,11 +1,9 @@
using Bit.Admin.AdminConsole.Controllers;
using Bit.Admin.AdminConsole.Models;
using Bit.Core;
using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.Core.AdminConsole.Providers.Interfaces;
using Bit.Core.Billing.Enums;
using Bit.Core.Services;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;
using Microsoft.AspNetCore.Mvc;
@ -86,9 +84,6 @@ public class ProvidersControllerTests
SutProvider<ProvidersController> sutProvider)
{
// Arrange
sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
.Returns(true);
// Act
var actual = await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);
@ -102,9 +97,6 @@ public class ProvidersControllerTests
model.OwnerEmail,
Arg.Is<PlanType>(y => y == model.Plan),
model.EnterpriseSeatMinimum);
sutProvider.GetDependency<IFeatureService>()
.Received(Quantity.Exactly(1))
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises);
}
[BitAutoData]
@ -129,10 +121,6 @@ public class ProvidersControllerTests
providerArgument.Id = expectedProviderId;
});
sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
.Returns(true);
// Act
var actual = await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);
@ -144,53 +132,6 @@ public class ProvidersControllerTests
Assert.Null(actualResult.ControllerName);
Assert.Equal(expectedProviderId, actualResult.RouteValues["Id"]);
}
[BitAutoData]
[SutProviderCustomize]
[Theory]
public async Task CreateMultiOrganizationEnterpriseAsync_ChecksFeatureFlag(
CreateMultiOrganizationEnterpriseProviderModel model,
SutProvider<ProvidersController> sutProvider)
{
// Arrange
sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
.Returns(true);
// Act
await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);
// Assert
sutProvider.GetDependency<IFeatureService>()
.Received(Quantity.Exactly(1))
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises);
}
[BitAutoData]
[SutProviderCustomize]
[Theory]
public async Task CreateMultiOrganizationEnterpriseAsync_RedirectsToProviderTypeSelectionPage_WhenFeatureFlagIsDisabled(
CreateMultiOrganizationEnterpriseProviderModel model,
SutProvider<ProvidersController> sutProvider)
{
// Arrange
sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
.Returns(false);
// Act
var actual = await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);
// Assert
sutProvider.GetDependency<IFeatureService>()
.Received(Quantity.Exactly(1))
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises);
Assert.IsType<RedirectToActionResult>(actual);
var actualResult = (RedirectToActionResult)actual;
Assert.Equal("Create", actualResult.ActionName);
Assert.Null(actualResult.ControllerName);
}
#endregion
#region CreateResellerAsync
@ -202,9 +143,6 @@ public class ProvidersControllerTests
SutProvider<ProvidersController> sutProvider)
{
// Arrange
sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
.Returns(true);
// Act
var actual = await sutProvider.Sut.CreateReseller(model);