mirror of
https://github.com/bitwarden/server
synced 2026-01-03 17:14:00 +00:00
[PM-18770] Convert Organization to Business Unit (#5610)
* [NO LOGIC] Rename MultiOrganizationEnterprise to BusinessUnit * [Core] Add IMailService.SendBusinessUnitConversionInviteAsync * [Core] Add BusinessUnitConverter * [Admin] Add new permission * [Admin] Add BusinessUnitConverterController * [Admin] Add Convert to Business Unit button to Organization edit page * [Api] Add OrganizationBillingController.SetupBusinessUnitAsync action * [Multi] Propagate provider type to sync response * [Multi] Put updates behind feature flag * [Tests] BusinessUnitConverterTests * Run dotnet format * Fixing post-main merge compilation failure
This commit is contained in:
@@ -14,9 +14,6 @@
|
||||
<ProjectReference Include="..\Core\Core.csproj" />
|
||||
<ProjectReference Include="..\..\util\SqliteMigrations\SqliteMigrations.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Billing\Controllers\" />
|
||||
</ItemGroup>
|
||||
|
||||
<Choose>
|
||||
<When Condition="!$(DefineConstants.Contains('OSS'))">
|
||||
|
||||
@@ -133,10 +133,10 @@ public class ProvidersController : Controller
|
||||
return View(new CreateResellerProviderModel());
|
||||
}
|
||||
|
||||
[HttpGet("providers/create/multi-organization-enterprise")]
|
||||
public IActionResult CreateMultiOrganizationEnterprise(int enterpriseMinimumSeats, string ownerEmail = null)
|
||||
[HttpGet("providers/create/business-unit")]
|
||||
public IActionResult CreateBusinessUnit(int enterpriseMinimumSeats, string ownerEmail = null)
|
||||
{
|
||||
return View(new CreateMultiOrganizationEnterpriseProviderModel
|
||||
return View(new CreateBusinessUnitProviderModel
|
||||
{
|
||||
OwnerEmail = ownerEmail,
|
||||
EnterpriseSeatMinimum = enterpriseMinimumSeats
|
||||
@@ -157,7 +157,7 @@ public class ProvidersController : Controller
|
||||
{
|
||||
ProviderType.Msp => RedirectToAction("CreateMsp"),
|
||||
ProviderType.Reseller => RedirectToAction("CreateReseller"),
|
||||
ProviderType.MultiOrganizationEnterprise => RedirectToAction("CreateMultiOrganizationEnterprise"),
|
||||
ProviderType.BusinessUnit => RedirectToAction("CreateBusinessUnit"),
|
||||
_ => View(model)
|
||||
};
|
||||
}
|
||||
@@ -198,10 +198,10 @@ public class ProvidersController : Controller
|
||||
return RedirectToAction("Edit", new { id = provider.Id });
|
||||
}
|
||||
|
||||
[HttpPost("providers/create/multi-organization-enterprise")]
|
||||
[HttpPost("providers/create/business-unit")]
|
||||
[ValidateAntiForgeryToken]
|
||||
[RequirePermission(Permission.Provider_Create)]
|
||||
public async Task<IActionResult> CreateMultiOrganizationEnterprise(CreateMultiOrganizationEnterpriseProviderModel model)
|
||||
public async Task<IActionResult> CreateBusinessUnit(CreateBusinessUnitProviderModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ public class ProvidersController : Controller
|
||||
}
|
||||
var provider = model.ToProvider();
|
||||
|
||||
await _createProviderCommand.CreateMultiOrganizationEnterpriseAsync(
|
||||
await _createProviderCommand.CreateBusinessUnitAsync(
|
||||
provider,
|
||||
model.OwnerEmail,
|
||||
model.Plan.Value,
|
||||
@@ -307,7 +307,7 @@ public class ProvidersController : Controller
|
||||
]);
|
||||
await _providerBillingService.UpdateSeatMinimums(updateMspSeatMinimumsCommand);
|
||||
break;
|
||||
case ProviderType.MultiOrganizationEnterprise:
|
||||
case ProviderType.BusinessUnit:
|
||||
{
|
||||
var existingMoePlan = providerPlans.Single();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using Bit.SharedWeb.Utilities;
|
||||
|
||||
namespace Bit.Admin.AdminConsole.Models;
|
||||
|
||||
public class CreateMultiOrganizationEnterpriseProviderModel : IValidatableObject
|
||||
public class CreateBusinessUnitProviderModel : IValidatableObject
|
||||
{
|
||||
[Display(Name = "Owner Email")]
|
||||
public string OwnerEmail { get; set; }
|
||||
@@ -22,7 +22,7 @@ public class CreateMultiOrganizationEnterpriseProviderModel : IValidatableObject
|
||||
{
|
||||
return new Provider
|
||||
{
|
||||
Type = ProviderType.MultiOrganizationEnterprise
|
||||
Type = ProviderType.BusinessUnit
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,17 +30,17 @@ public class CreateMultiOrganizationEnterpriseProviderModel : IValidatableObject
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(OwnerEmail))
|
||||
{
|
||||
var ownerEmailDisplayName = nameof(OwnerEmail).GetDisplayAttribute<CreateMultiOrganizationEnterpriseProviderModel>()?.GetName() ?? nameof(OwnerEmail);
|
||||
var ownerEmailDisplayName = nameof(OwnerEmail).GetDisplayAttribute<CreateBusinessUnitProviderModel>()?.GetName() ?? nameof(OwnerEmail);
|
||||
yield return new ValidationResult($"The {ownerEmailDisplayName} field is required.");
|
||||
}
|
||||
if (EnterpriseSeatMinimum < 0)
|
||||
{
|
||||
var enterpriseSeatMinimumDisplayName = nameof(EnterpriseSeatMinimum).GetDisplayAttribute<CreateMultiOrganizationEnterpriseProviderModel>()?.GetName() ?? nameof(EnterpriseSeatMinimum);
|
||||
var enterpriseSeatMinimumDisplayName = nameof(EnterpriseSeatMinimum).GetDisplayAttribute<CreateBusinessUnitProviderModel>()?.GetName() ?? nameof(EnterpriseSeatMinimum);
|
||||
yield return new ValidationResult($"The {enterpriseSeatMinimumDisplayName} field can not be negative.");
|
||||
}
|
||||
if (Plan != PlanType.EnterpriseAnnually && Plan != PlanType.EnterpriseMonthly)
|
||||
{
|
||||
var planDisplayName = nameof(Plan).GetDisplayAttribute<CreateMultiOrganizationEnterpriseProviderModel>()?.GetName() ?? nameof(Plan);
|
||||
var planDisplayName = nameof(Plan).GetDisplayAttribute<CreateBusinessUnitProviderModel>()?.GetName() ?? nameof(Plan);
|
||||
yield return new ValidationResult($"The {planDisplayName} field must be set to Enterprise Annually or Enterprise Monthly.");
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class ProviderEditModel : ProviderViewModel, IValidatableObject
|
||||
GatewaySubscriptionUrl = gatewaySubscriptionUrl;
|
||||
Type = provider.Type;
|
||||
|
||||
if (Type == ProviderType.MultiOrganizationEnterprise)
|
||||
if (Type == ProviderType.BusinessUnit)
|
||||
{
|
||||
var plan = providerPlans.SingleOrDefault();
|
||||
EnterpriseMinimumSeats = plan?.SeatMinimum ?? 0;
|
||||
@@ -100,7 +100,7 @@ public class ProviderEditModel : ProviderViewModel, IValidatableObject
|
||||
yield return new ValidationResult($"The {billingEmailDisplayName} field is required.");
|
||||
}
|
||||
break;
|
||||
case ProviderType.MultiOrganizationEnterprise:
|
||||
case ProviderType.BusinessUnit:
|
||||
if (Plan == null)
|
||||
{
|
||||
var displayName = nameof(Plan).GetDisplayAttribute<CreateProviderModel>()?.GetName() ?? nameof(Plan);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ProviderViewModel
|
||||
ProviderPlanViewModels.Add(new ProviderPlanViewModel("Enterprise (Monthly) Subscription", enterpriseProviderPlan, usedEnterpriseSeats));
|
||||
}
|
||||
}
|
||||
else if (Provider.Type == ProviderType.MultiOrganizationEnterprise)
|
||||
else if (Provider.Type == ProviderType.BusinessUnit)
|
||||
{
|
||||
var usedEnterpriseSeats = ProviderOrganizations.Where(po => po.PlanType == PlanType.EnterpriseMonthly)
|
||||
.Sum(po => po.OccupiedSeats).GetValueOrDefault(0);
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
@using Bit.Admin.Enums;
|
||||
@using Bit.Admin.Models
|
||||
@using Bit.Core
|
||||
@using Bit.Core.AdminConsole.Enums.Provider
|
||||
@using Bit.Core.Billing.Enums
|
||||
@using Bit.Core.Enums
|
||||
@using Bit.Core.Billing.Extensions
|
||||
@using Bit.Core.Services
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@inject Bit.Admin.Services.IAccessControlService AccessControlService
|
||||
@inject IFeatureService FeatureService
|
||||
@model OrganizationEditModel
|
||||
@{
|
||||
ViewData["Title"] = (Model.Provider != null ? "Client " : string.Empty) + "Organization: " + Model.Name;
|
||||
@@ -13,6 +18,13 @@
|
||||
var canRequestDelete = AccessControlService.UserHasPermission(Permission.Org_RequestDelete);
|
||||
var canDelete = AccessControlService.UserHasPermission(Permission.Org_Delete);
|
||||
var canUnlinkFromProvider = AccessControlService.UserHasPermission(Permission.Provider_Edit);
|
||||
|
||||
var canConvertToBusinessUnit =
|
||||
FeatureService.IsEnabled(FeatureFlagKeys.PM18770_EnableOrganizationBusinessUnitConversion) &&
|
||||
AccessControlService.UserHasPermission(Permission.Org_Billing_ConvertToBusinessUnit) &&
|
||||
Model.Organization.PlanType.GetProductTier() == ProductTierType.Enterprise &&
|
||||
!string.IsNullOrEmpty(Model.Organization.GatewaySubscriptionId) &&
|
||||
Model.Provider is null or { Type: ProviderType.BusinessUnit, Status: ProviderStatusType.Pending };
|
||||
}
|
||||
|
||||
@section Scripts {
|
||||
@@ -114,6 +126,15 @@
|
||||
Enterprise Trial
|
||||
</button>
|
||||
}
|
||||
@if (canConvertToBusinessUnit)
|
||||
{
|
||||
<a asp-controller="BusinessUnitConversion"
|
||||
asp-action="Index"
|
||||
asp-route-organizationId="@Model.Organization.Id"
|
||||
class="btn btn-secondary me-2">
|
||||
Convert to Business Unit
|
||||
</a>
|
||||
}
|
||||
@if (canUnlinkFromProvider && Model.Provider is not null)
|
||||
{
|
||||
<button class="btn btn-outline-danger me-2"
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
@using Bit.Core.Billing.Enums
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
@model CreateMultiOrganizationEnterpriseProviderModel
|
||||
@model CreateBusinessUnitProviderModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Create Multi-organization Enterprise Provider";
|
||||
ViewData["Title"] = "Create Business Unit Provider";
|
||||
}
|
||||
|
||||
<h1 class="mb-4">Create Multi-organization Enterprise Provider</h1>
|
||||
<h1 class="mb-4">Create Business Unit Provider</h1>
|
||||
<div>
|
||||
<form method="post" asp-action="CreateMultiOrganizationEnterprise">
|
||||
<form method="post" asp-action="CreateBusinessUnit">
|
||||
<div asp-validation-summary="All" class="alert alert-danger"></div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="OwnerEmail" class="form-label"></label>
|
||||
@@ -19,14 +19,14 @@
|
||||
<div class="col-sm">
|
||||
<div class="mb-3">
|
||||
@{
|
||||
var multiOrgPlans = new List<PlanType>
|
||||
var businessUnitPlanTypes = new List<PlanType>
|
||||
{
|
||||
PlanType.EnterpriseAnnually,
|
||||
PlanType.EnterpriseMonthly
|
||||
};
|
||||
}
|
||||
<label asp-for="Plan" class="form-label"></label>
|
||||
<select class="form-select" asp-for="Plan" asp-items="Html.GetEnumSelectList(multiOrgPlans)">
|
||||
<select class="form-select" asp-for="Plan" asp-items="Html.GetEnumSelectList(businessUnitPlanTypes)">
|
||||
<option value="">--</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -74,20 +74,20 @@
|
||||
</div>
|
||||
break;
|
||||
}
|
||||
case ProviderType.MultiOrganizationEnterprise:
|
||||
case ProviderType.BusinessUnit:
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<div class="mb-3">
|
||||
@{
|
||||
var multiOrgPlans = new List<PlanType>
|
||||
var businessUnitPlanTypes = 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)">
|
||||
<select class="form-control" asp-for="Plan" asp-items="Html.GetEnumSelectList(businessUnitPlanTypes)">
|
||||
<option value="">--</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
#nullable enable
|
||||
using Bit.Admin.Billing.Models;
|
||||
using Bit.Admin.Enums;
|
||||
using Bit.Admin.Utilities;
|
||||
using Bit.Core;
|
||||
using Bit.Core.AdminConsole.Entities;
|
||||
using Bit.Core.AdminConsole.Entities.Provider;
|
||||
using Bit.Core.AdminConsole.Enums.Provider;
|
||||
using Bit.Core.AdminConsole.Repositories;
|
||||
using Bit.Core.Billing.Services;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Bit.Admin.Billing.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Route("organizations/billing/{organizationId:guid}/business-unit")]
|
||||
[RequireFeature(FeatureFlagKeys.PM18770_EnableOrganizationBusinessUnitConversion)]
|
||||
public class BusinessUnitConversionController(
|
||||
IBusinessUnitConverter businessUnitConverter,
|
||||
IOrganizationRepository organizationRepository,
|
||||
IProviderRepository providerRepository,
|
||||
IProviderUserRepository providerUserRepository) : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
[RequirePermission(Permission.Org_Billing_ConvertToBusinessUnit)]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task<IActionResult> IndexAsync([FromRoute] Guid organizationId)
|
||||
{
|
||||
var organization = await organizationRepository.GetByIdAsync(organizationId);
|
||||
|
||||
if (organization == null)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var model = new BusinessUnitConversionModel { Organization = organization };
|
||||
|
||||
var invitedProviderAdmin = await GetInvitedProviderAdminAsync(organization);
|
||||
|
||||
if (invitedProviderAdmin != null)
|
||||
{
|
||||
model.ProviderAdminEmail = invitedProviderAdmin.Email;
|
||||
model.ProviderId = invitedProviderAdmin.ProviderId;
|
||||
}
|
||||
|
||||
var success = ReadSuccessMessage();
|
||||
|
||||
if (!string.IsNullOrEmpty(success))
|
||||
{
|
||||
model.Success = success;
|
||||
}
|
||||
|
||||
var errors = ReadErrorMessages();
|
||||
|
||||
if (errors is { Count: > 0 })
|
||||
{
|
||||
model.Errors = errors;
|
||||
}
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[RequirePermission(Permission.Org_Billing_ConvertToBusinessUnit)]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task<IActionResult> InitiateAsync(
|
||||
[FromRoute] Guid organizationId,
|
||||
BusinessUnitConversionModel model)
|
||||
{
|
||||
var organization = await organizationRepository.GetByIdAsync(organizationId);
|
||||
|
||||
if (organization == null)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var result = await businessUnitConverter.InitiateConversion(
|
||||
organization,
|
||||
model.ProviderAdminEmail!);
|
||||
|
||||
return result.Match(
|
||||
providerId => RedirectToAction("Edit", "Providers", new { id = providerId }),
|
||||
errors =>
|
||||
{
|
||||
PersistErrorMessages(errors);
|
||||
return RedirectToAction("Index", new { organizationId });
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("reset")]
|
||||
[RequirePermission(Permission.Org_Billing_ConvertToBusinessUnit)]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task<IActionResult> ResetAsync(
|
||||
[FromRoute] Guid organizationId,
|
||||
BusinessUnitConversionModel model)
|
||||
{
|
||||
var organization = await organizationRepository.GetByIdAsync(organizationId);
|
||||
|
||||
if (organization == null)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
await businessUnitConverter.ResetConversion(organization, model.ProviderAdminEmail!);
|
||||
|
||||
PersistSuccessMessage("Business unit conversion was successfully reset.");
|
||||
|
||||
return RedirectToAction("Index", new { organizationId });
|
||||
}
|
||||
|
||||
[HttpPost("resend-invite")]
|
||||
[RequirePermission(Permission.Org_Billing_ConvertToBusinessUnit)]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task<IActionResult> ResendInviteAsync(
|
||||
[FromRoute] Guid organizationId,
|
||||
BusinessUnitConversionModel model)
|
||||
{
|
||||
var organization = await organizationRepository.GetByIdAsync(organizationId);
|
||||
|
||||
if (organization == null)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
await businessUnitConverter.ResendConversionInvite(organization, model.ProviderAdminEmail!);
|
||||
|
||||
PersistSuccessMessage($"Invite was successfully resent to {model.ProviderAdminEmail}.");
|
||||
|
||||
return RedirectToAction("Index", new { organizationId });
|
||||
}
|
||||
|
||||
private async Task<ProviderUser?> GetInvitedProviderAdminAsync(
|
||||
Organization organization)
|
||||
{
|
||||
var provider = await providerRepository.GetByOrganizationIdAsync(organization.Id);
|
||||
|
||||
if (provider is not
|
||||
{
|
||||
Type: ProviderType.BusinessUnit,
|
||||
Status: ProviderStatusType.Pending
|
||||
})
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var providerUsers =
|
||||
await providerUserRepository.GetManyByProviderAsync(provider.Id, ProviderUserType.ProviderAdmin);
|
||||
|
||||
if (providerUsers.Count != 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var providerUser = providerUsers.First();
|
||||
|
||||
return providerUser is
|
||||
{
|
||||
Type: ProviderUserType.ProviderAdmin,
|
||||
Status: ProviderUserStatusType.Invited,
|
||||
UserId: not null
|
||||
} ? providerUser : null;
|
||||
}
|
||||
|
||||
private const string _errors = "errors";
|
||||
private const string _success = "Success";
|
||||
|
||||
private void PersistSuccessMessage(string message) => TempData[_success] = message;
|
||||
private void PersistErrorMessages(List<string> errors)
|
||||
{
|
||||
var input = string.Join("|", errors);
|
||||
TempData[_errors] = input;
|
||||
}
|
||||
private string? ReadSuccessMessage() => ReadTempData<string>(_success);
|
||||
private List<string>? ReadErrorMessages()
|
||||
{
|
||||
var output = ReadTempData<string>(_errors);
|
||||
return string.IsNullOrEmpty(output) ? null : output.Split('|').ToList();
|
||||
}
|
||||
|
||||
private T? ReadTempData<T>(string key) => TempData.TryGetValue(key, out var obj) && obj is T value ? value : default;
|
||||
}
|
||||
25
src/Admin/Billing/Models/BusinessUnitConversionModel.cs
Normal file
25
src/Admin/Billing/Models/BusinessUnitConversionModel.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
#nullable enable
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.AdminConsole.Entities;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
|
||||
namespace Bit.Admin.Billing.Models;
|
||||
|
||||
public class BusinessUnitConversionModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[Display(Name = "Provider Admin Email")]
|
||||
public string? ProviderAdminEmail { get; set; }
|
||||
|
||||
[BindNever]
|
||||
public required Organization Organization { get; set; }
|
||||
|
||||
[BindNever]
|
||||
public Guid? ProviderId { get; set; }
|
||||
|
||||
[BindNever]
|
||||
public string? Success { get; set; }
|
||||
|
||||
[BindNever] public List<string>? Errors { get; set; } = [];
|
||||
}
|
||||
75
src/Admin/Billing/Views/BusinessUnitConversion/Index.cshtml
Normal file
75
src/Admin/Billing/Views/BusinessUnitConversion/Index.cshtml
Normal file
@@ -0,0 +1,75 @@
|
||||
@model Bit.Admin.Billing.Models.BusinessUnitConversionModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Convert Organization to Business Unit";
|
||||
}
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.ProviderAdminEmail))
|
||||
{
|
||||
<h1>Convert @Model.Organization.Name to Business Unit</h1>
|
||||
@if (!string.IsNullOrEmpty(Model.Success))
|
||||
{
|
||||
<div class="alert alert-success alert-dismissible fade show mb-3" role="alert">
|
||||
@Model.Success
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
}
|
||||
@if (Model.Errors?.Any() ?? false)
|
||||
{
|
||||
@foreach (var error in Model.Errors)
|
||||
{
|
||||
<div class="alert alert-danger alert-dismissible fade show mb-3" role="alert">
|
||||
@error
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<p>This organization has a business unit conversion in progress.</p>
|
||||
|
||||
<div class="mb-3">
|
||||
<label asp-for="ProviderAdminEmail" class="form-label"></label>
|
||||
<input type="email" class="form-control" asp-for="ProviderAdminEmail" disabled></input>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<form method="post" asp-controller="BusinessUnitConversion" asp-action="ResendInvite" asp-route-organizationId="@Model.Organization.Id">
|
||||
<input type="hidden" asp-for="ProviderAdminEmail" />
|
||||
<button type="submit" class="btn btn-primary mb-2">Resend Invite</button>
|
||||
</form>
|
||||
<form method="post" asp-controller="BusinessUnitConversion" asp-action="Reset" asp-route-organizationId="@Model.Organization.Id">
|
||||
<input type="hidden" asp-for="ProviderAdminEmail" />
|
||||
<button type="submit" class="btn btn-danger mb-2">Reset Conversion</button>
|
||||
</form>
|
||||
@if (Model.ProviderId.HasValue)
|
||||
{
|
||||
<a asp-controller="Providers"
|
||||
asp-action="Edit"
|
||||
asp-route-id="@Model.ProviderId"
|
||||
class="btn btn-secondary mb-2">
|
||||
Go to Provider
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h1>Convert @Model.Organization.Name to Business Unit</h1>
|
||||
@if (Model.Errors?.Any() ?? false)
|
||||
{
|
||||
@foreach (var error in Model.Errors)
|
||||
{
|
||||
<div class="alert alert-danger alert-dismissible fade show mb-3" role="alert">
|
||||
@error
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<form method="post" asp-controller="BusinessUnitConversion" asp-action="Initiate" asp-route-organizationId="@Model.Organization.Id">
|
||||
<div asp-validation-summary="All" class="alert alert-danger"></div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="ProviderAdminEmail" class="form-label"></label>
|
||||
<input type="email" class="form-control" asp-for="ProviderAdminEmail" />
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary mb-2">Convert</button>
|
||||
</form>
|
||||
}
|
||||
@@ -38,6 +38,7 @@ public enum Permission
|
||||
Org_Billing_View,
|
||||
Org_Billing_Edit,
|
||||
Org_Billing_LaunchGateway,
|
||||
Org_Billing_ConvertToBusinessUnit,
|
||||
|
||||
Provider_List_View,
|
||||
Provider_Create,
|
||||
|
||||
@@ -42,6 +42,7 @@ public static class RolePermissionMapping
|
||||
Permission.Org_Billing_View,
|
||||
Permission.Org_Billing_Edit,
|
||||
Permission.Org_Billing_LaunchGateway,
|
||||
Permission.Org_Billing_ConvertToBusinessUnit,
|
||||
Permission.Provider_List_View,
|
||||
Permission.Provider_Create,
|
||||
Permission.Provider_View,
|
||||
@@ -90,6 +91,7 @@ public static class RolePermissionMapping
|
||||
Permission.Org_Billing_View,
|
||||
Permission.Org_Billing_Edit,
|
||||
Permission.Org_Billing_LaunchGateway,
|
||||
Permission.Org_Billing_ConvertToBusinessUnit,
|
||||
Permission.Org_InitiateTrial,
|
||||
Permission.Provider_List_View,
|
||||
Permission.Provider_Create,
|
||||
@@ -166,6 +168,7 @@ public static class RolePermissionMapping
|
||||
Permission.Org_Billing_View,
|
||||
Permission.Org_Billing_Edit,
|
||||
Permission.Org_Billing_LaunchGateway,
|
||||
Permission.Org_Billing_ConvertToBusinessUnit,
|
||||
Permission.Org_RequestDelete,
|
||||
Permission.Provider_Edit,
|
||||
Permission.Provider_View,
|
||||
|
||||
Reference in New Issue
Block a user