mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01: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.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@ -11,4 +12,29 @@ public partial class Admins(
|
||||
private readonly bool _canResendEmailInvite = accessControlService.UserHasPermission(Permission.Provider_ResendEmailInvite);
|
||||
|
||||
[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
|
||||
@inject Services.IAccessControlService AccessControlService
|
||||
@using Bit.Core.AdminConsole.Services
|
||||
|
||||
@inject IAccessControlService AccessControlService
|
||||
@inject IProviderService ProviderService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h2>Provider Admins</h2>
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 190px;">Email</th>
|
||||
<th style="width: 40px;">Status</th>
|
||||
<th style="width: 30px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(!Model.ProviderAdmins.Any())
|
||||
{
|
||||
<tr>
|
||||
<td colspan="6">No results to list.</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach(var admin in Model.ProviderAdmins)
|
||||
{
|
||||
<tr>
|
||||
<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)
|
||||
<EditForm FormName="ManageAdminsForm" Model="FormModel" OnValidSubmit="OnValidSubmitAsync">
|
||||
<DataAnnotationsValidator />
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 190px;">Email</th>
|
||||
<th style="width: 40px;">Status</th>
|
||||
<th style="width: 30px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (!Model.ProviderAdmins.Any())
|
||||
{
|
||||
<tr>
|
||||
<td colspan="6">No results to list.</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var admin in Model.ProviderAdmins)
|
||||
{
|
||||
<!--@if(@TempData["InviteResentTo"] != null && @TempData["InviteResentTo"].ToString() == @admin.UserId.Value.ToString())
|
||||
{
|
||||
<button class="btn btn-outline-success btn-sm disabled" disabled>Invite Resent!</button>
|
||||
<tr>
|
||||
<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 (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
|
||||
{
|
||||
<a class="btn btn-outline-secondary btn-sm"
|
||||
data-id="@admin.Id" asp-controller="Providers"
|
||||
asp-action="ResendInvite" asp-route-ownerId="@admin.UserId"
|
||||
asp-route-providerId="@Model.Provider.Id">
|
||||
Resend Setup Invite
|
||||
</a>
|
||||
}-->
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</EditForm>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
<h2>Provider Information</h2>
|
||||
<ViewInformation Model="@ViewModel" />
|
||||
<Admins Model="@ViewModel" />
|
||||
<Admins Model="@ViewModel" ProviderId="@Id" />
|
||||
<form method="post" id="edit-form">
|
||||
<div asp-validation-summary="All" class="alert alert-danger"></div>
|
||||
<input type="hidden" asp-for="Type" readonly>
|
||||
|
Loading…
Reference in New Issue
Block a user