Browse Source
* Added a button for resending provider setup emails * Fixed a case typo in a stored procedure * Turned a couple lines of code into a method call * Added service level validation against inviting users for MSP invites * Code review improvements for provider invites created a factory for provider user invites wrote tests for provider invite permissions" * changed a few exception typespull/1498/head
14 changed files with 204 additions and 67 deletions
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
@model ProviderViewModel |
||||
<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)) |
||||
{ |
||||
@if(@TempData["InviteResentTo"] != null && @TempData["InviteResentTo"].ToString() == @admin.UserId.Value.ToString()) |
||||
{ |
||||
<button class="btn btn-outline-success btn-sm disabled" disabled>Invite Resent!</button> |
||||
} |
||||
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> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
@ -1,5 +1,6 @@
@@ -1,5 +1,6 @@
|
||||
@using Microsoft.AspNetCore.Identity |
||||
@using Bit.Admin |
||||
@using Bit.Admin.Models |
||||
@using Bit.Core.Enums.Provider |
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
||||
@addTagHelper "*, Admin" |
||||
@addTagHelper "*, Admin" |
||||
|
||||
@ -1,19 +1,39 @@
@@ -1,19 +1,39 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using Bit.Core.Enums.Provider; |
||||
using Bit.Core.Models.Api; |
||||
using Bit.Core.Models.Data; |
||||
|
||||
namespace Bit.Core.Models.Business.Provider |
||||
{ |
||||
public class ProviderUserInvite |
||||
public class ProviderUserInvite<T> |
||||
{ |
||||
public IEnumerable<string> Emails { get; set; } |
||||
public IEnumerable<T> UserIdentifiers { get; set; } |
||||
public ProviderUserType Type { get; set; } |
||||
public Guid InvitingUserId { get; set; } |
||||
public Guid ProviderId { get; set; } |
||||
} |
||||
|
||||
public static class ProviderUserInviteFactory |
||||
{ |
||||
public static ProviderUserInvite<string> CreateIntialInvite(IEnumerable<string> inviteeEmails, ProviderUserType type, Guid invitingUserId, Guid providerId) |
||||
{ |
||||
return new ProviderUserInvite<string> |
||||
{ |
||||
UserIdentifiers = inviteeEmails, |
||||
Type = type, |
||||
InvitingUserId = invitingUserId, |
||||
ProviderId = providerId |
||||
}; |
||||
} |
||||
|
||||
public ProviderUserInvite(ProviderUserInviteRequestModel requestModel) |
||||
public static ProviderUserInvite<Guid> CreateReinvite(IEnumerable<Guid> inviteeUserIds, Guid invitingUserId, Guid providerId) |
||||
{ |
||||
Emails = requestModel.Emails; |
||||
Type = requestModel.Type.Value; |
||||
return new ProviderUserInvite<Guid> |
||||
{ |
||||
UserIdentifiers = inviteeUserIds, |
||||
InvitingUserId = invitingUserId, |
||||
ProviderId = providerId |
||||
}; |
||||
} |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue