mirror of
https://github.com/bitwarden/server.git
synced 2025-04-21 21:15:10 -05:00
[PM-17593] Remove Multi-Org Enterprise feature flag (#5351)
This commit is contained in:
parent
06c96a96c5
commit
f6365fa385
@ -3,7 +3,6 @@ using System.Net;
|
|||||||
using Bit.Admin.AdminConsole.Models;
|
using Bit.Admin.AdminConsole.Models;
|
||||||
using Bit.Admin.Enums;
|
using Bit.Admin.Enums;
|
||||||
using Bit.Admin.Utilities;
|
using Bit.Admin.Utilities;
|
||||||
using Bit.Core;
|
|
||||||
using Bit.Core.AdminConsole.Entities.Provider;
|
using Bit.Core.AdminConsole.Entities.Provider;
|
||||||
using Bit.Core.AdminConsole.Enums.Provider;
|
using Bit.Core.AdminConsole.Enums.Provider;
|
||||||
using Bit.Core.AdminConsole.Providers.Interfaces;
|
using Bit.Core.AdminConsole.Providers.Interfaces;
|
||||||
@ -133,11 +132,6 @@ public class ProvidersController : Controller
|
|||||||
[HttpGet("providers/create/multi-organization-enterprise")]
|
[HttpGet("providers/create/multi-organization-enterprise")]
|
||||||
public IActionResult CreateMultiOrganizationEnterprise(int enterpriseMinimumSeats, string ownerEmail = null)
|
public IActionResult CreateMultiOrganizationEnterprise(int enterpriseMinimumSeats, string ownerEmail = null)
|
||||||
{
|
{
|
||||||
if (!_featureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises))
|
|
||||||
{
|
|
||||||
return RedirectToAction("Create");
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(new CreateMultiOrganizationEnterpriseProviderModel
|
return View(new CreateMultiOrganizationEnterpriseProviderModel
|
||||||
{
|
{
|
||||||
OwnerEmail = ownerEmail,
|
OwnerEmail = ownerEmail,
|
||||||
@ -211,10 +205,6 @@ public class ProvidersController : Controller
|
|||||||
}
|
}
|
||||||
var provider = model.ToProvider();
|
var provider = model.ToProvider();
|
||||||
|
|
||||||
if (!_featureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises))
|
|
||||||
{
|
|
||||||
return RedirectToAction("Create");
|
|
||||||
}
|
|
||||||
await _createProviderCommand.CreateMultiOrganizationEnterpriseAsync(
|
await _createProviderCommand.CreateMultiOrganizationEnterpriseAsync(
|
||||||
provider,
|
provider,
|
||||||
model.OwnerEmail,
|
model.OwnerEmail,
|
||||||
|
@ -12,11 +12,6 @@
|
|||||||
var providerTypes = Enum.GetValues<ProviderType>()
|
var providerTypes = Enum.GetValues<ProviderType>()
|
||||||
.OrderBy(x => x.GetDisplayAttribute().Order)
|
.OrderBy(x => x.GetDisplayAttribute().Order)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (!FeatureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises))
|
|
||||||
{
|
|
||||||
providerTypes.Remove(ProviderType.MultiOrganizationEnterprise);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>Create Provider</h1>
|
<h1>Create Provider</h1>
|
||||||
|
@ -76,32 +76,29 @@
|
|||||||
}
|
}
|
||||||
case ProviderType.MultiOrganizationEnterprise:
|
case ProviderType.MultiOrganizationEnterprise:
|
||||||
{
|
{
|
||||||
@if (FeatureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises) && Model.Provider.Type == ProviderType.MultiOrganizationEnterprise)
|
<div class="row">
|
||||||
{
|
<div class="col-sm">
|
||||||
<div class="row">
|
<div class="mb-3">
|
||||||
<div class="col-sm">
|
@{
|
||||||
<div class="mb-3">
|
var multiOrgPlans = new List<PlanType>
|
||||||
@{
|
{
|
||||||
var multiOrgPlans = new List<PlanType>
|
PlanType.EnterpriseAnnually,
|
||||||
{
|
PlanType.EnterpriseMonthly
|
||||||
PlanType.EnterpriseAnnually,
|
};
|
||||||
PlanType.EnterpriseMonthly
|
}
|
||||||
};
|
<label asp-for="Plan" class="form-label"></label>
|
||||||
}
|
<select class="form-control" asp-for="Plan" asp-items="Html.GetEnumSelectList(multiOrgPlans)">
|
||||||
<label asp-for="Plan" class="form-label"></label>
|
<option value="">--</option>
|
||||||
<select class="form-control" asp-for="Plan" asp-items="Html.GetEnumSelectList(multiOrgPlans)">
|
</select>
|
||||||
<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>
|
||||||
</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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public static class FeatureFlagKeys
|
|||||||
public const string StorageReseedRefactor = "storage-reseed-refactor";
|
public const string StorageReseedRefactor = "storage-reseed-refactor";
|
||||||
public const string TrialPayment = "PM-8163-trial-payment";
|
public const string TrialPayment = "PM-8163-trial-payment";
|
||||||
public const string RemoveServerVersionHeader = "remove-server-version-header";
|
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 NewDeviceVerification = "new-device-verification";
|
||||||
public const string NewDeviceVerificationTemporaryDismiss = "new-device-temporary-dismiss";
|
public const string NewDeviceVerificationTemporaryDismiss = "new-device-temporary-dismiss";
|
||||||
public const string NewDeviceVerificationPermanentDismiss = "new-device-permanent-dismiss";
|
public const string NewDeviceVerificationPermanentDismiss = "new-device-permanent-dismiss";
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
using Bit.Admin.AdminConsole.Controllers;
|
using Bit.Admin.AdminConsole.Controllers;
|
||||||
using Bit.Admin.AdminConsole.Models;
|
using Bit.Admin.AdminConsole.Models;
|
||||||
using Bit.Core;
|
|
||||||
using Bit.Core.AdminConsole.Entities.Provider;
|
using Bit.Core.AdminConsole.Entities.Provider;
|
||||||
using Bit.Core.AdminConsole.Enums.Provider;
|
using Bit.Core.AdminConsole.Enums.Provider;
|
||||||
using Bit.Core.AdminConsole.Providers.Interfaces;
|
using Bit.Core.AdminConsole.Providers.Interfaces;
|
||||||
using Bit.Core.Billing.Enums;
|
using Bit.Core.Billing.Enums;
|
||||||
using Bit.Core.Services;
|
|
||||||
using Bit.Test.Common.AutoFixture;
|
using Bit.Test.Common.AutoFixture;
|
||||||
using Bit.Test.Common.AutoFixture.Attributes;
|
using Bit.Test.Common.AutoFixture.Attributes;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -86,9 +84,6 @@ public class ProvidersControllerTests
|
|||||||
SutProvider<ProvidersController> sutProvider)
|
SutProvider<ProvidersController> sutProvider)
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
sutProvider.GetDependency<IFeatureService>()
|
|
||||||
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
|
|
||||||
.Returns(true);
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var actual = await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);
|
var actual = await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);
|
||||||
@ -102,9 +97,6 @@ public class ProvidersControllerTests
|
|||||||
model.OwnerEmail,
|
model.OwnerEmail,
|
||||||
Arg.Is<PlanType>(y => y == model.Plan),
|
Arg.Is<PlanType>(y => y == model.Plan),
|
||||||
model.EnterpriseSeatMinimum);
|
model.EnterpriseSeatMinimum);
|
||||||
sutProvider.GetDependency<IFeatureService>()
|
|
||||||
.Received(Quantity.Exactly(1))
|
|
||||||
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BitAutoData]
|
[BitAutoData]
|
||||||
@ -129,10 +121,6 @@ public class ProvidersControllerTests
|
|||||||
providerArgument.Id = expectedProviderId;
|
providerArgument.Id = expectedProviderId;
|
||||||
});
|
});
|
||||||
|
|
||||||
sutProvider.GetDependency<IFeatureService>()
|
|
||||||
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
|
|
||||||
.Returns(true);
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var actual = await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);
|
var actual = await sutProvider.Sut.CreateMultiOrganizationEnterprise(model);
|
||||||
|
|
||||||
@ -144,53 +132,6 @@ public class ProvidersControllerTests
|
|||||||
Assert.Null(actualResult.ControllerName);
|
Assert.Null(actualResult.ControllerName);
|
||||||
Assert.Equal(expectedProviderId, actualResult.RouteValues["Id"]);
|
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
|
#endregion
|
||||||
|
|
||||||
#region CreateResellerAsync
|
#region CreateResellerAsync
|
||||||
@ -202,9 +143,6 @@ public class ProvidersControllerTests
|
|||||||
SutProvider<ProvidersController> sutProvider)
|
SutProvider<ProvidersController> sutProvider)
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
sutProvider.GetDependency<IFeatureService>()
|
|
||||||
.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)
|
|
||||||
.Returns(true);
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var actual = await sutProvider.Sut.CreateReseller(model);
|
var actual = await sutProvider.Sut.CreateReseller(model);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user