Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/Admin/AdminConsole/Controllers/ProvidersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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;
Expand Down Expand Up @@ -133,11 +132,6 @@ public IActionResult CreateReseller()
[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,
Expand Down Expand Up @@ -211,10 +205,6 @@ public async Task<IActionResult> CreateMultiOrganizationEnterprise(CreateMultiOr
}
var provider = model.ToProvider();

if (!_featureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises))
{
return RedirectToAction("Create");
}
await _createProviderCommand.CreateMultiOrganizationEnterpriseAsync(
provider,
model.OwnerEmail,
Expand Down
5 changes: 0 additions & 5 deletions src/Admin/AdminConsole/Views/Providers/Create.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
43 changes: 20 additions & 23 deletions src/Admin/AdminConsole/Views/Providers/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -72,32 +72,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 class="row">
<div class="col-sm">
<div class="mb-3">
@{
var multiOrgPlans = new List<PlanType>
{
PlanType.EnterpriseAnnually,
PlanType.EnterpriseMonthly
};

Check warning on line 83 in src/Admin/AdminConsole/Views/Providers/Edit.cshtml

View check run for this annotation

Codecov / codecov/patch

src/Admin/AdminConsole/Views/Providers/Edit.cshtml#L80-L83

Added lines #L80 - L83 were not covered by tests
}
<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 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 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;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ 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 RiskInsightsCriticalApplication = "pm-14466-risk-insights-critical-application";
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -86,9 +84,6 @@ public async Task CreateMultiOrganizationEnterpriseAsync_WithValidModel_CreatesP
SutProvider<ProvidersController> sutProvider)
{
// Arrange
sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
.Returns(true);

// Act
var actual = await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);
Expand All @@ -102,9 +97,6 @@ await sutProvider.GetDependency<ICreateProviderCommand>()
model.OwnerEmail,
Arg.Is<PlanType>(y => y == model.Plan),
model.EnterpriseSeatMinimum);
sutProvider.GetDependency<IFeatureService>()
.Received(Quantity.Exactly(1))
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises);
}

[BitAutoData]
Expand All @@ -129,10 +121,6 @@ public async Task CreateMultiOrganizationEnterpriseAsync_RedirectsToExpectedPage
providerArgument.Id = expectedProviderId;
});

sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
.Returns(true);

// Act
var actual = await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);

Expand All @@ -144,53 +132,6 @@ public async Task CreateMultiOrganizationEnterpriseAsync_RedirectsToExpectedPage
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
Expand All @@ -202,9 +143,6 @@ public async Task CreateResellerAsync_WithValidModel_CreatesProvider(
SutProvider<ProvidersController> sutProvider)
{
// Arrange
sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
.Returns(true);

// Act
var actual = await sutProvider.Sut.CreateReseller(model);
Expand Down
Loading