Skip to content

Commit 06c0c4c

Browse files
[NO LOGIC] Rename MultiOrganizationEnterprise to BusinessUnit
1 parent 39ac933 commit 06c0c4c

File tree

18 files changed

+59
-59
lines changed

18 files changed

+59
-59
lines changed

bitwarden_license/src/Commercial.Core/AdminConsole/Providers/CreateProviderCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public async Task CreateResellerAsync(Provider provider)
4848
await ProviderRepositoryCreateAsync(provider, ProviderStatusType.Created);
4949
}
5050

51-
public async Task CreateMultiOrganizationEnterpriseAsync(Provider provider, string ownerEmail, PlanType plan, int minimumSeats)
51+
public async Task CreateBusinessUnitAsync(Provider provider, string ownerEmail, PlanType plan, int minimumSeats)
5252
{
5353
var providerId = await CreateProviderAsync(provider, ownerEmail);
5454

bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,10 @@ private void ThrowOnInvalidPlanType(ProviderType providerType, PlanType requeste
692692
throw new BadRequestException($"Managed Service Providers cannot manage organizations with the plan type {requestedType}. Only Teams (Monthly) and Enterprise (Monthly) are allowed.");
693693
}
694694
break;
695-
case ProviderType.MultiOrganizationEnterprise:
695+
case ProviderType.BusinessUnit:
696696
if (requestedType is not (PlanType.EnterpriseMonthly or PlanType.EnterpriseAnnually))
697697
{
698-
throw new BadRequestException($"Multi-organization Enterprise Providers cannot manage organizations with the plan type {requestedType}. Only Enterprise (Monthly) and Enterprise (Annually) are allowed.");
698+
throw new BadRequestException($"Business Unit Providers cannot manage organizations with the plan type {requestedType}. Only Enterprise (Monthly) and Enterprise (Annually) are allowed.");
699699
}
700700
break;
701701
case ProviderType.Reseller:

bitwarden_license/src/Commercial.Core/Billing/ProviderBillingService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ private async Task<PlanType> GetManagedPlanTypeAsync(
791791
Provider provider,
792792
Organization organization)
793793
{
794-
if (provider.Type == ProviderType.MultiOrganizationEnterprise)
794+
if (provider.Type == ProviderType.BusinessUnit)
795795
{
796796
return (await providerPlanRepository.GetByProviderId(provider.Id)).First().PlanType;
797797
}

bitwarden_license/src/Commercial.Core/Billing/ProviderPriceAdapter.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static class Legacy
5151
/// <param name="subscription">The provider's subscription.</param>
5252
/// <param name="planType">The plan type correlating to the desired Stripe price ID.</param>
5353
/// <returns>A Stripe <see cref="Stripe.Price"/> ID.</returns>
54-
/// <exception cref="BillingException">Thrown when the provider's type is not <see cref="ProviderType.Msp"/> or <see cref="ProviderType.MultiOrganizationEnterprise"/>.</exception>
54+
/// <exception cref="BillingException">Thrown when the provider's type is not <see cref="ProviderType.Msp"/> or <see cref="ProviderType.BusinessUnit"/>.</exception>
5555
/// <exception cref="BillingException">Thrown when the provided <see cref="planType"/> does not relate to a Stripe price ID.</exception>
5656
public static string GetPriceId(
5757
Provider provider,
@@ -78,7 +78,7 @@ public static string GetPriceId(
7878
PlanType.EnterpriseMonthly => MSP.Active.Enterprise,
7979
_ => throw invalidPlanType
8080
},
81-
ProviderType.MultiOrganizationEnterprise => BusinessUnit.Legacy.List.Intersect(priceIds).Any()
81+
ProviderType.BusinessUnit => BusinessUnit.Legacy.List.Intersect(priceIds).Any()
8282
? planType switch
8383
{
8484
PlanType.EnterpriseAnnually => BusinessUnit.Legacy.Annually,
@@ -103,7 +103,7 @@ public static string GetPriceId(
103103
/// <param name="provider">The provider to get the Stripe price ID for.</param>
104104
/// <param name="planType">The plan type correlating to the desired Stripe price ID.</param>
105105
/// <returns>A Stripe <see cref="Stripe.Price"/> ID.</returns>
106-
/// <exception cref="BillingException">Thrown when the provider's type is not <see cref="ProviderType.Msp"/> or <see cref="ProviderType.MultiOrganizationEnterprise"/>.</exception>
106+
/// <exception cref="BillingException">Thrown when the provider's type is not <see cref="ProviderType.Msp"/> or <see cref="ProviderType.BusinessUnit"/>.</exception>
107107
/// <exception cref="BillingException">Thrown when the provided <see cref="planType"/> does not relate to a Stripe price ID.</exception>
108108
public static string GetActivePriceId(
109109
Provider provider,
@@ -120,7 +120,7 @@ public static string GetActivePriceId(
120120
PlanType.EnterpriseMonthly => MSP.Active.Enterprise,
121121
_ => throw invalidPlanType
122122
},
123-
ProviderType.MultiOrganizationEnterprise => planType switch
123+
ProviderType.BusinessUnit => planType switch
124124
{
125125
PlanType.EnterpriseAnnually => BusinessUnit.Active.Annually,
126126
PlanType.EnterpriseMonthly => BusinessUnit.Active.Monthly,

bitwarden_license/test/Commercial.Core.Test/AdminConsole/ProviderFeatures/CreateProviderCommandTests.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,29 @@ public async Task CreateResellerAsync_Success(Provider provider, SutProvider<Cre
6363
}
6464

6565
[Theory, BitAutoData]
66-
public async Task CreateMultiOrganizationEnterpriseAsync_Success(
66+
public async Task CreateBusinessUnitAsync_Success(
6767
Provider provider,
6868
User user,
6969
PlanType plan,
7070
int minimumSeats,
7171
SutProvider<CreateProviderCommand> sutProvider)
7272
{
7373
// Arrange
74-
provider.Type = ProviderType.MultiOrganizationEnterprise;
74+
provider.Type = ProviderType.BusinessUnit;
7575

7676
var userRepository = sutProvider.GetDependency<IUserRepository>();
7777
userRepository.GetByEmailAsync(user.Email).Returns(user);
7878

7979
// Act
80-
await sutProvider.Sut.CreateMultiOrganizationEnterpriseAsync(provider, user.Email, plan, minimumSeats);
80+
await sutProvider.Sut.CreateBusinessUnitAsync(provider, user.Email, plan, minimumSeats);
8181

8282
// Assert
8383
await sutProvider.GetDependency<IProviderRepository>().ReceivedWithAnyArgs().CreateAsync(provider);
8484
await sutProvider.GetDependency<IProviderService>().Received(1).SendProviderSetupInviteEmailAsync(provider, user.Email);
8585
}
8686

8787
[Theory, BitAutoData]
88-
public async Task CreateMultiOrganizationEnterpriseAsync_UserIdIsInvalid_Throws(
88+
public async Task CreateBusinessUnitAsync_UserIdIsInvalid_Throws(
8989
Provider provider,
9090
SutProvider<CreateProviderCommand> sutProvider)
9191
{
@@ -94,7 +94,7 @@ public async Task CreateMultiOrganizationEnterpriseAsync_UserIdIsInvalid_Throws(
9494

9595
// Act
9696
var exception = await Assert.ThrowsAsync<BadRequestException>(
97-
() => sutProvider.Sut.CreateMultiOrganizationEnterpriseAsync(provider, default, default, default));
97+
() => sutProvider.Sut.CreateBusinessUnitAsync(provider, default, default, default));
9898

9999
// Assert
100100
Assert.Contains("Invalid owner.", exception.Message);

bitwarden_license/test/Commercial.Core.Test/Billing/ProviderBillingServiceTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public async Task ChangePlan_UpdatesSubscriptionCorrectly(
116116
SutProvider<ProviderBillingService> sutProvider)
117117
{
118118
// Arrange
119-
provider.Type = ProviderType.MultiOrganizationEnterprise;
119+
provider.Type = ProviderType.BusinessUnit;
120120

121121
var providerPlanRepository = sutProvider.GetDependency<IProviderPlanRepository>();
122122
var existingPlan = new ProviderPlan

bitwarden_license/test/Commercial.Core.Test/Billing/ProviderPriceAdapterTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void GetPriceId_BusinessUnit_Legacy_Succeeds(string priceId, PlanType pla
7171
var provider = new Provider
7272
{
7373
Id = Guid.NewGuid(),
74-
Type = ProviderType.MultiOrganizationEnterprise
74+
Type = ProviderType.BusinessUnit
7575
};
7676

7777
var subscription = new Subscription
@@ -98,7 +98,7 @@ public void GetPriceId_BusinessUnit_Active_Succeeds(string priceId, PlanType pla
9898
var provider = new Provider
9999
{
100100
Id = Guid.NewGuid(),
101-
Type = ProviderType.MultiOrganizationEnterprise
101+
Type = ProviderType.BusinessUnit
102102
};
103103

104104
var subscription = new Subscription
@@ -141,7 +141,7 @@ public void GetActivePriceId_BusinessUnit_Succeeds(string priceId, PlanType plan
141141
var provider = new Provider
142142
{
143143
Id = Guid.NewGuid(),
144-
Type = ProviderType.MultiOrganizationEnterprise
144+
Type = ProviderType.BusinessUnit
145145
};
146146

147147
var result = ProviderPriceAdapter.GetActivePriceId(provider, planType);

src/Admin/AdminConsole/Controllers/ProvidersController.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ public IActionResult CreateReseller()
133133
return View(new CreateResellerProviderModel());
134134
}
135135

136-
[HttpGet("providers/create/multi-organization-enterprise")]
137-
public IActionResult CreateMultiOrganizationEnterprise(int enterpriseMinimumSeats, string ownerEmail = null)
136+
[HttpGet("providers/create/business-unit")]
137+
public IActionResult CreateBusinessUnit(int enterpriseMinimumSeats, string ownerEmail = null)
138138
{
139-
return View(new CreateMultiOrganizationEnterpriseProviderModel
139+
return View(new CreateBusinessUnitProviderModel
140140
{
141141
OwnerEmail = ownerEmail,
142142
EnterpriseSeatMinimum = enterpriseMinimumSeats
@@ -157,7 +157,7 @@ public IActionResult Create(CreateProviderModel model)
157157
{
158158
ProviderType.Msp => RedirectToAction("CreateMsp"),
159159
ProviderType.Reseller => RedirectToAction("CreateReseller"),
160-
ProviderType.MultiOrganizationEnterprise => RedirectToAction("CreateMultiOrganizationEnterprise"),
160+
ProviderType.BusinessUnit => RedirectToAction("CreateBusinessUnit"),
161161
_ => View(model)
162162
};
163163
}
@@ -198,18 +198,18 @@ public async Task<IActionResult> CreateReseller(CreateResellerProviderModel mode
198198
return RedirectToAction("Edit", new { id = provider.Id });
199199
}
200200

201-
[HttpPost("providers/create/multi-organization-enterprise")]
201+
[HttpPost("providers/create/business-unit")]
202202
[ValidateAntiForgeryToken]
203203
[RequirePermission(Permission.Provider_Create)]
204-
public async Task<IActionResult> CreateMultiOrganizationEnterprise(CreateMultiOrganizationEnterpriseProviderModel model)
204+
public async Task<IActionResult> CreateBusinessUnit(CreateBusinessUnitProviderModel model)
205205
{
206206
if (!ModelState.IsValid)
207207
{
208208
return View(model);
209209
}
210210
var provider = model.ToProvider();
211211

212-
await _createProviderCommand.CreateMultiOrganizationEnterpriseAsync(
212+
await _createProviderCommand.CreateBusinessUnitAsync(
213213
provider,
214214
model.OwnerEmail,
215215
model.Plan.Value,
@@ -307,7 +307,7 @@ public async Task<IActionResult> Edit(Guid id, ProviderEditModel model)
307307
]);
308308
await _providerBillingService.UpdateSeatMinimums(updateMspSeatMinimumsCommand);
309309
break;
310-
case ProviderType.MultiOrganizationEnterprise:
310+
case ProviderType.BusinessUnit:
311311
{
312312
var existingMoePlan = providerPlans.Single();
313313

src/Admin/AdminConsole/Models/CreateMultiOrganizationEnterpriseProviderModel.cs src/Admin/AdminConsole/Models/CreateBusinessUnitProviderModel.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Bit.Admin.AdminConsole.Models;
88

9-
public class CreateMultiOrganizationEnterpriseProviderModel : IValidatableObject
9+
public class CreateBusinessUnitProviderModel : IValidatableObject
1010
{
1111
[Display(Name = "Owner Email")]
1212
public string OwnerEmail { get; set; }
@@ -22,25 +22,25 @@ public virtual Provider ToProvider()
2222
{
2323
return new Provider
2424
{
25-
Type = ProviderType.MultiOrganizationEnterprise
25+
Type = ProviderType.BusinessUnit
2626
};
2727
}
2828

2929
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
3030
{
3131
if (string.IsNullOrWhiteSpace(OwnerEmail))
3232
{
33-
var ownerEmailDisplayName = nameof(OwnerEmail).GetDisplayAttribute<CreateMultiOrganizationEnterpriseProviderModel>()?.GetName() ?? nameof(OwnerEmail);
33+
var ownerEmailDisplayName = nameof(OwnerEmail).GetDisplayAttribute<CreateBusinessUnitProviderModel>()?.GetName() ?? nameof(OwnerEmail);
3434
yield return new ValidationResult($"The {ownerEmailDisplayName} field is required.");
3535
}
3636
if (EnterpriseSeatMinimum < 0)
3737
{
38-
var enterpriseSeatMinimumDisplayName = nameof(EnterpriseSeatMinimum).GetDisplayAttribute<CreateMultiOrganizationEnterpriseProviderModel>()?.GetName() ?? nameof(EnterpriseSeatMinimum);
38+
var enterpriseSeatMinimumDisplayName = nameof(EnterpriseSeatMinimum).GetDisplayAttribute<CreateBusinessUnitProviderModel>()?.GetName() ?? nameof(EnterpriseSeatMinimum);
3939
yield return new ValidationResult($"The {enterpriseSeatMinimumDisplayName} field can not be negative.");
4040
}
4141
if (Plan != PlanType.EnterpriseAnnually && Plan != PlanType.EnterpriseMonthly)
4242
{
43-
var planDisplayName = nameof(Plan).GetDisplayAttribute<CreateMultiOrganizationEnterpriseProviderModel>()?.GetName() ?? nameof(Plan);
43+
var planDisplayName = nameof(Plan).GetDisplayAttribute<CreateBusinessUnitProviderModel>()?.GetName() ?? nameof(Plan);
4444
yield return new ValidationResult($"The {planDisplayName} field must be set to Enterprise Annually or Enterprise Monthly.");
4545
}
4646
}

src/Admin/AdminConsole/Models/ProviderEditModel.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public ProviderEditModel(
3434
GatewaySubscriptionUrl = gatewaySubscriptionUrl;
3535
Type = provider.Type;
3636

37-
if (Type == ProviderType.MultiOrganizationEnterprise)
37+
if (Type == ProviderType.BusinessUnit)
3838
{
3939
var plan = providerPlans.SingleOrDefault();
4040
EnterpriseMinimumSeats = plan?.SeatMinimum ?? 0;
@@ -100,7 +100,7 @@ public IEnumerable<ValidationResult> Validate(ValidationContext validationContex
100100
yield return new ValidationResult($"The {billingEmailDisplayName} field is required.");
101101
}
102102
break;
103-
case ProviderType.MultiOrganizationEnterprise:
103+
case ProviderType.BusinessUnit:
104104
if (Plan == null)
105105
{
106106
var displayName = nameof(Plan).GetDisplayAttribute<CreateProviderModel>()?.GetName() ?? nameof(Plan);

src/Admin/AdminConsole/Models/ProviderViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public ProviderViewModel(
4040
ProviderPlanViewModels.Add(new ProviderPlanViewModel("Enterprise (Monthly) Subscription", enterpriseProviderPlan, usedEnterpriseSeats));
4141
}
4242
}
43-
else if (Provider.Type == ProviderType.MultiOrganizationEnterprise)
43+
else if (Provider.Type == ProviderType.BusinessUnit)
4444
{
4545
var usedEnterpriseSeats = ProviderOrganizations.Where(po => po.PlanType == PlanType.EnterpriseMonthly)
4646
.Sum(po => po.OccupiedSeats).GetValueOrDefault(0);

src/Admin/AdminConsole/Views/Providers/CreateMultiOrganizationEnterprise.cshtml src/Admin/AdminConsole/Views/Providers/CreateBusinessUnit.cshtml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
@using Bit.Core.Billing.Enums
22
@using Microsoft.AspNetCore.Mvc.TagHelpers
33

4-
@model CreateMultiOrganizationEnterpriseProviderModel
4+
@model CreateBusinessUnitProviderModel
55

66
@{
7-
ViewData["Title"] = "Create Multi-organization Enterprise Provider";
7+
ViewData["Title"] = "Create Business Unit Provider";
88
}
99

10-
<h1 class="mb-4">Create Multi-organization Enterprise Provider</h1>
10+
<h1 class="mb-4">Create Business Unit Provider</h1>
1111
<div>
12-
<form method="post" asp-action="CreateMultiOrganizationEnterprise">
12+
<form method="post" asp-action="CreateBusinessUnit">
1313
<div asp-validation-summary="All" class="alert alert-danger"></div>
1414
<div class="mb-3">
1515
<label asp-for="OwnerEmail" class="form-label"></label>
@@ -19,14 +19,14 @@
1919
<div class="col-sm">
2020
<div class="mb-3">
2121
@{
22-
var multiOrgPlans = new List<PlanType>
22+
var businessUnitPlanTypes = new List<PlanType>
2323
{
2424
PlanType.EnterpriseAnnually,
2525
PlanType.EnterpriseMonthly
2626
};
2727
}
2828
<label asp-for="Plan" class="form-label"></label>
29-
<select class="form-select" asp-for="Plan" asp-items="Html.GetEnumSelectList(multiOrgPlans)">
29+
<select class="form-select" asp-for="Plan" asp-items="Html.GetEnumSelectList(businessUnitPlanTypes)">
3030
<option value="">--</option>
3131
</select>
3232
</div>

src/Admin/AdminConsole/Views/Providers/Edit.cshtml

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,20 @@
7474
</div>
7575
break;
7676
}
77-
case ProviderType.MultiOrganizationEnterprise:
77+
case ProviderType.BusinessUnit:
7878
{
7979
<div class="row">
8080
<div class="col-sm">
8181
<div class="mb-3">
8282
@{
83-
var multiOrgPlans = new List<PlanType>
83+
var businessUnitPlanTypes = new List<PlanType>
8484
{
8585
PlanType.EnterpriseAnnually,
8686
PlanType.EnterpriseMonthly
8787
};
8888
}
8989
<label asp-for="Plan" class="form-label"></label>
90-
<select class="form-control" asp-for="Plan" asp-items="Html.GetEnumSelectList(multiOrgPlans)">
90+
<select class="form-control" asp-for="Plan" asp-items="Html.GetEnumSelectList(businessUnitPlanTypes)">
9191
<option value="">--</option>
9292
</select>
9393
</div>

src/Core/AdminConsole/Enums/Provider/ProviderType.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ public enum ProviderType : byte
88
Msp = 0,
99
[Display(ShortName = "Reseller", Name = "Reseller", Description = "Creates Bitwarden Portal page for client organization billing management", Order = 1000)]
1010
Reseller = 1,
11-
[Display(ShortName = "MOE", Name = "Multi-organization Enterprises", Description = "Creates provider portal for multi-organization management", Order = 1)]
12-
MultiOrganizationEnterprise = 2,
11+
[Display(ShortName = "Business Unit", Name = "Business Unit", Description = "Creates provider portal for business unit management", Order = 1)]
12+
BusinessUnit = 2,
1313
}

src/Core/AdminConsole/Providers/Interfaces/ICreateProviderCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ public interface ICreateProviderCommand
77
{
88
Task CreateMspAsync(Provider provider, string ownerEmail, int teamsMinimumSeats, int enterpriseMinimumSeats);
99
Task CreateResellerAsync(Provider provider);
10-
Task CreateMultiOrganizationEnterpriseAsync(Provider provider, string ownerEmail, PlanType plan, int minimumSeats);
10+
Task CreateBusinessUnitAsync(Provider provider, string ownerEmail, PlanType plan, int minimumSeats);
1111
}

src/Core/Billing/Extensions/BillingExtensions.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ _ when planType.ToString().Contains("Enterprise") => ProductTierType.Enterprise,
2424
public static bool IsBillable(this Provider provider) =>
2525
provider is
2626
{
27-
Type: ProviderType.Msp or ProviderType.MultiOrganizationEnterprise,
27+
Type: ProviderType.Msp or ProviderType.BusinessUnit,
2828
Status: ProviderStatusType.Billable
2929
};
3030

3131
public static bool SupportsConsolidatedBilling(this ProviderType providerType)
32-
=> providerType is ProviderType.Msp or ProviderType.MultiOrganizationEnterprise;
32+
=> providerType is ProviderType.Msp or ProviderType.BusinessUnit;
3333

3434
public static bool IsValidClient(this Organization organization)
3535
=> organization is

src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationRepository.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ join od in dbContext.OrganizationDomains on ou.OrganizationId equals od.Organiza
330330
var planTypes = providerType switch
331331
{
332332
ProviderType.Msp => PlanConstants.EnterprisePlanTypes.Concat(PlanConstants.TeamsPlanTypes),
333-
ProviderType.MultiOrganizationEnterprise => PlanConstants.EnterprisePlanTypes,
333+
ProviderType.BusinessUnit => PlanConstants.EnterprisePlanTypes,
334334
_ => []
335335
};
336336

0 commit comments

Comments
 (0)