mirror of
https://github.com/bitwarden/server
synced 2026-01-06 02:23:51 +00:00
* [deps] Auth: Update bootstrap to v5 [SECURITY] * Update bootstrap and import dependencies in site.scss * Update site.scss to include the theme color 'dark' * Refactor site.scss to merge the 'primary-accent' theme color into the existing theme colors * Update bootstrap classes for v5 * Refactor form layout in Index.cshtml and AddExistingOrganization.cshtml * Revert change to the shield icon in the navbar * Fix organization form select inputs * Fixed search input sizes * Fix elements in Providers and Users search * More bootstrap migration * Revert change to tax rate delete button * Add missing label classes in Users/Edit.cshtml * More component migrations * Refactor form classes and labels in CreateMsp.cshtml and CreateReseller.cshtml * Update package dependencies in Sso * Revert changes to Providers/Edit.cshtml * Refactor CreateMultiOrganizationEnterprise.cshtml and Providers/Edit.cshtml for bootstrap 5 * Refactor webpack.config.js to use @popperjs/core instead of popper.js * Remove popperjs package dependency * Restore Bootstrap 4 link styling behavior - Remove default text decoration - Add underline only on hover * Update Bootstrap to version 5.3.3 * Update deprecated text color classes from 'text-muted' to 'text-body-secondary' across various views * Refactor provider edit view for bootstrap 5 * Remove underline in Add/Create organization links in provider page --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Rui Tome <rtome@bitwarden.com> Co-authored-by: Rui Tomé <108268980+r-tome@users.noreply.github.com>
137 lines
6.3 KiB
Plaintext
137 lines
6.3 KiB
Plaintext
@using Bit.Admin.Enums;
|
|
@using Bit.Admin.Models
|
|
@using Bit.Core.Billing.Enums
|
|
@using Bit.Core.Enums
|
|
@inject Bit.Admin.Services.IAccessControlService AccessControlService
|
|
@model OrganizationEditModel
|
|
@{
|
|
ViewData["Title"] = (Model.Provider != null ? "Client " : string.Empty) + "Organization: " + Model.Name;
|
|
|
|
var canViewOrganizationInformation = AccessControlService.UserHasPermission(Permission.Org_OrgInformation_View);
|
|
var canViewBillingInformation = AccessControlService.UserHasPermission(Permission.Org_BillingInformation_View);
|
|
var canInitiateTrial = AccessControlService.UserHasPermission(Permission.Org_InitiateTrial);
|
|
var canDelete = AccessControlService.UserHasPermission(Permission.Org_Delete);
|
|
var canUnlinkFromProvider = AccessControlService.UserHasPermission(Permission.Provider_Edit);
|
|
}
|
|
|
|
@section Scripts {
|
|
@await Html.PartialAsync("~/AdminConsole/Views/Shared/_OrganizationFormScripts.cshtml")
|
|
|
|
<script>
|
|
(() => {
|
|
const treamsTrialButton = document.getElementById('teams-trial');
|
|
if (treamsTrialButton != null) {
|
|
treamsTrialButton.addEventListener('click', () => {
|
|
if (document.getElementById('@(nameof(Model.PlanType))').value !== '@((byte)PlanType.Free)') {
|
|
alert('Organization is not on a free plan.');
|
|
return;
|
|
}
|
|
setTrialDefaults('@((byte)PlanType.TeamsAnnually)');
|
|
togglePlanFeatures('@((byte)PlanType.TeamsAnnually)');
|
|
document.getElementById('@(nameof(Model.Plan))').value = 'Teams (Trial)';
|
|
});
|
|
}
|
|
|
|
const entTrialButton = document.getElementById('enterprise-trial');
|
|
if (entTrialButton != null) {
|
|
entTrialButton.addEventListener('click', () => {
|
|
if (document.getElementById('@(nameof(Model.PlanType))').value !== '@((byte)PlanType.Free)') {
|
|
alert('Organization is not on a free plan.');
|
|
return;
|
|
}
|
|
setTrialDefaults('@((byte)PlanType.EnterpriseAnnually)');
|
|
togglePlanFeatures('@((byte)PlanType.EnterpriseAnnually)');
|
|
document.getElementById('@(nameof(Model.Plan))').value = 'Enterprise (Trial)';
|
|
});
|
|
}
|
|
|
|
const initDeleteButton = document.getElementById('initiate-delete-form');
|
|
if (initDeleteButton != null) {
|
|
initDeleteButton.addEventListener('submit', (e) => {
|
|
const email = prompt('Enter the email address of the owner/admin that your want to ' +
|
|
'request the organization delete verification process with.');
|
|
document.getElementById('AdminEmail').value = email;
|
|
if (email == null || email === '') {
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
}
|
|
|
|
function setTrialDefaults(planType) {
|
|
// Plan
|
|
document.getElementById('@(nameof(Model.PlanType))').value = planType;
|
|
// Password Manager
|
|
document.getElementById('@(nameof(Model.Seats))').value = '10';
|
|
document.getElementById('@(nameof(Model.MaxCollections))').value = '';
|
|
document.getElementById('@(nameof(Model.MaxStorageGb))').value = '1';
|
|
// Secret Manager
|
|
if (document.getElementById('@(nameof(Model.UseSecretsManager))').checked) {
|
|
document.getElementById('@(nameof(Model.SmSeats))').value = '10';
|
|
document.getElementById('@(nameof(Model.SmServiceAccounts))').value = getPlan(planType)?.baseServiceAccount;
|
|
}
|
|
// Licensing
|
|
document.getElementById('@(nameof(Model.LicenseKey))').value = '@Model.RandomLicenseKey';
|
|
document.getElementById('@(nameof(Model.ExpirationDate))').value = '@Model.FourteenDayExpirationDate';
|
|
document.getElementById('@(nameof(Model.SalesAssistedTrialStarted))').value = true;
|
|
}
|
|
})();
|
|
</script>
|
|
}
|
|
|
|
<h1>@(Model.Provider != null ? "Client " : string.Empty)Organization <small>@Model.Name</small></h1>
|
|
|
|
@if (Model.Provider != null)
|
|
{
|
|
<h2>Provider Relationship</h2>
|
|
@await Html.PartialAsync("_ProviderInformation", Model.Provider)
|
|
}
|
|
|
|
@if (canViewOrganizationInformation)
|
|
{
|
|
<h2>Organization Information</h2>
|
|
@await Html.PartialAsync("_ViewInformation", Model)
|
|
}
|
|
|
|
@if (canViewBillingInformation)
|
|
{
|
|
<h2>Billing Information</h2>
|
|
@await Html.PartialAsync("_BillingInformation",
|
|
new BillingInformationModel { BillingInfo = Model.BillingInfo, BillingHistoryInfo = Model.BillingHistoryInfo, OrganizationId = Model.Organization.Id, Entity = "Organization" })
|
|
}
|
|
|
|
@await Html.PartialAsync("~/AdminConsole/Views/Shared/_OrganizationForm.cshtml", Model)
|
|
|
|
<div class="d-flex mt-4">
|
|
<button type="submit" class="btn btn-primary" form="edit-form">Save</button>
|
|
<div class="ms-auto d-flex">
|
|
@if (canInitiateTrial && Model.Provider is null)
|
|
{
|
|
<button class="btn btn-secondary me-2" type="button" id="teams-trial">
|
|
Teams Trial
|
|
</button>
|
|
<button class="btn btn-secondary me-2" type="button" id="enterprise-trial">
|
|
Enterprise Trial
|
|
</button>
|
|
}
|
|
@if (canUnlinkFromProvider && Model.Provider is not null)
|
|
{
|
|
<button class="btn btn-outline-danger me-2"
|
|
onclick="return unlinkProvider('@Model.Organization.Id');">
|
|
Unlink provider
|
|
</button>
|
|
}
|
|
@if (canDelete)
|
|
{
|
|
<form asp-action="DeleteInitiation" asp-route-id="@Model.Organization.Id" id="initiate-delete-form">
|
|
<input type="hidden" name="AdminEmail" id="AdminEmail" />
|
|
<button class="btn btn-danger me-2" type="submit">Request Delete</button>
|
|
</form>
|
|
<form asp-action="Delete" asp-route-id="@Model.Organization.Id"
|
|
onsubmit="return confirm('Are you sure you want to hard delete this organization?')">
|
|
<button class="btn btn-outline-danger" type="submit">Delete</button>
|
|
</form>
|
|
}
|
|
</div>
|
|
</div>
|
|
|