mirror of
https://github.com/bitwarden/server.git
synced 2025-04-27 07:42:15 -05:00
wip
This commit is contained in:
parent
420247a5e4
commit
65bc9bb01f
@ -1,4 +1,5 @@
|
|||||||
using Bit.Admin.AdminConsole.Models;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Bit.Admin.AdminConsole.Models;
|
||||||
using Bit.Admin.Enums;
|
using Bit.Admin.Enums;
|
||||||
using Bit.Admin.Services;
|
using Bit.Admin.Services;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
@ -11,4 +12,29 @@ public partial class Admins(
|
|||||||
private readonly bool _canResendEmailInvite = accessControlService.UserHasPermission(Permission.Provider_ResendEmailInvite);
|
private readonly bool _canResendEmailInvite = accessControlService.UserHasPermission(Permission.Provider_ResendEmailInvite);
|
||||||
|
|
||||||
[Parameter] public ProviderViewModel Model { get; set; }
|
[Parameter] public ProviderViewModel Model { get; set; }
|
||||||
|
|
||||||
|
[SupplyParameterFromForm(FormName = "ManageAdminsForm")]
|
||||||
|
public ManageAdminsFormModel FormModel { get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Guid ProviderId { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Guid OwnerId { get; set; }
|
||||||
|
|
||||||
|
[SupplyParameterFromQuery]
|
||||||
|
public Guid? InviteResentTo { get; set; }
|
||||||
|
|
||||||
|
private async Task OnValidSubmitAsync()
|
||||||
|
{
|
||||||
|
await ProviderService.ResendProviderSetupInviteEmailAsync(ProviderId, OwnerId);
|
||||||
|
var uri = NavigationManager.GetUriWithQueryParameters($"/admin/providers/{ProviderId}/admins", new Dictionary<string, object?> { { "inviteResentTo", OwnerId.ToString() } });
|
||||||
|
NavigationManager.NavigateTo(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ManageAdminsFormModel
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public Guid UserId { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,61 +1,69 @@
|
|||||||
|
@using Bit.Admin.Services
|
||||||
@using Bit.Core.AdminConsole.Enums.Provider
|
@using Bit.Core.AdminConsole.Enums.Provider
|
||||||
@inject Services.IAccessControlService AccessControlService
|
@using Bit.Core.AdminConsole.Services
|
||||||
|
|
||||||
|
@inject IAccessControlService AccessControlService
|
||||||
|
@inject IProviderService ProviderService
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
<h2>Provider Admins</h2>
|
<h2>Provider Admins</h2>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover">
|
<EditForm FormName="ManageAdminsForm" Model="FormModel" OnValidSubmit="OnValidSubmitAsync">
|
||||||
<thead>
|
<DataAnnotationsValidator />
|
||||||
<tr>
|
<table class="table table-striped table-hover">
|
||||||
<th style="width: 190px;">Email</th>
|
<thead>
|
||||||
<th style="width: 40px;">Status</th>
|
<tr>
|
||||||
<th style="width: 30px;"></th>
|
<th style="width: 190px;">Email</th>
|
||||||
</tr>
|
<th style="width: 40px;">Status</th>
|
||||||
</thead>
|
<th style="width: 30px;"></th>
|
||||||
<tbody>
|
</tr>
|
||||||
@if(!Model.ProviderAdmins.Any())
|
</thead>
|
||||||
{
|
<tbody>
|
||||||
<tr>
|
@if (!Model.ProviderAdmins.Any())
|
||||||
<td colspan="6">No results to list.</td>
|
{
|
||||||
</tr>
|
<tr>
|
||||||
}
|
<td colspan="6">No results to list.</td>
|
||||||
else
|
</tr>
|
||||||
{
|
}
|
||||||
@foreach(var admin in Model.ProviderAdmins)
|
else
|
||||||
{
|
{
|
||||||
<tr>
|
@foreach (var admin in Model.ProviderAdmins)
|
||||||
<td class="align-middle">
|
|
||||||
@admin.Email
|
|
||||||
</td>
|
|
||||||
<td class="align-middle">
|
|
||||||
@admin.Status
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if(admin.Status.Equals(ProviderUserStatusType.Confirmed)
|
|
||||||
&& Model.Provider.Status.Equals(ProviderStatusType.Pending)
|
|
||||||
&& _canResendEmailInvite)
|
|
||||||
{
|
{
|
||||||
<!--@if(@TempData["InviteResentTo"] != null && @TempData["InviteResentTo"].ToString() == @admin.UserId.Value.ToString())
|
<tr>
|
||||||
{
|
<td class="align-middle">
|
||||||
<button class="btn btn-outline-success btn-sm disabled" disabled>Invite Resent!</button>
|
@admin.Email
|
||||||
|
</td>
|
||||||
|
<td class="align-middle">
|
||||||
|
@admin.Status
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if (admin.Status.Equals(ProviderUserStatusType.Confirmed)
|
||||||
|
&& Model.Provider.Status.Equals(ProviderStatusType.Pending)
|
||||||
|
&& _canResendEmailInvite)
|
||||||
|
{
|
||||||
|
@if (InviteResentTo == admin.UserId!.Value)
|
||||||
|
{
|
||||||
|
<button class="btn btn-outline-success btn-sm disabled" disabled>Invite Resent!</button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button class="btn btn-outline-secondary btn-sm"
|
||||||
|
type="submit"
|
||||||
|
name="FormModel.UserId"
|
||||||
|
value="@admin.Id">
|
||||||
|
Resend Setup Invite
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
</tbody>
|
||||||
<a class="btn btn-outline-secondary btn-sm"
|
</table>
|
||||||
data-id="@admin.Id" asp-controller="Providers"
|
</EditForm>
|
||||||
asp-action="ResendInvite" asp-route-ownerId="@admin.UserId"
|
|
||||||
asp-route-providerId="@Model.Provider.Id">
|
|
||||||
Resend Setup Invite
|
|
||||||
</a>
|
|
||||||
}-->
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<h2>Provider Information</h2>
|
<h2>Provider Information</h2>
|
||||||
<ViewInformation Model="@ViewModel" />
|
<ViewInformation Model="@ViewModel" />
|
||||||
<Admins Model="@ViewModel" />
|
<Admins Model="@ViewModel" ProviderId="@Id" />
|
||||||
<form method="post" id="edit-form">
|
<form method="post" id="edit-form">
|
||||||
<div asp-validation-summary="All" class="alert alert-danger"></div>
|
<div asp-validation-summary="All" class="alert alert-danger"></div>
|
||||||
<input type="hidden" asp-for="Type" readonly>
|
<input type="hidden" asp-for="Type" readonly>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user