13 changed files with 142 additions and 50 deletions
@ -0,0 +1,27 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using Bit.Core.Enums; |
||||||
|
using Bit.Core.Models.Data; |
||||||
|
using Bit.Core.Models.Table; |
||||||
|
|
||||||
|
namespace Bit.Admin.Models |
||||||
|
{ |
||||||
|
public class OrganizationViewModel |
||||||
|
{ |
||||||
|
public OrganizationViewModel() { } |
||||||
|
|
||||||
|
public OrganizationViewModel(Organization org, IEnumerable<OrganizationUserUserDetails> orgUsers) |
||||||
|
{ |
||||||
|
Organization = org; |
||||||
|
UserCount = orgUsers.Count(); |
||||||
|
Owners = string.Join(", ", orgUsers.Where(u => u.Type == OrganizationUserType.Owner).Select(u => u.Email)); |
||||||
|
Admins = string.Join(", ", orgUsers.Where(u => u.Type == OrganizationUserType.Admin).Select(u => u.Email)); |
||||||
|
} |
||||||
|
|
||||||
|
public Organization Organization { get; set; } |
||||||
|
public string Owners { get; set; } |
||||||
|
public string Admins { get; set; } |
||||||
|
public int UserCount { get; set; } |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using Bit.Core.Models.Table; |
||||||
|
|
||||||
|
namespace Bit.Admin.Models |
||||||
|
{ |
||||||
|
public class UserViewModel |
||||||
|
{ |
||||||
|
public UserViewModel() { } |
||||||
|
|
||||||
|
public UserViewModel(User user, IEnumerable<Cipher> ciphers) |
||||||
|
{ |
||||||
|
User = user; |
||||||
|
CipherCount = ciphers.Count(); |
||||||
|
} |
||||||
|
|
||||||
|
public User User { get; set; } |
||||||
|
public int CipherCount { get; set; } |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
@model OrganizationViewModel |
||||||
|
@{ |
||||||
|
ViewData["Title"] = "Organization: " + Model.Organization.Name; |
||||||
|
} |
||||||
|
|
||||||
|
<h1>Organization <small>@Model.Organization.Name</small></h1> |
||||||
|
|
||||||
|
<h2>Information</h2> |
||||||
|
@Html.Partial("_ViewInformation", Model) |
||||||
|
<form asp-action="Delete" asp-route-id="@Model.Organization.Id" |
||||||
|
onsubmit="return confirm('Are you sure you want to delete this organization (@Model.Organization.Name)?')"> |
||||||
|
<button class="btn btn-danger" type="submit">Delete</button> |
||||||
|
</form> |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
@model OrganizationViewModel |
||||||
|
<dl class="row"> |
||||||
|
<dt class="col-sm-2">Id</dt> |
||||||
|
<dd class="col-sm-10"><code>@Model.Organization.Id</code></dd> |
||||||
|
|
||||||
|
<dt class="col-sm-2">Users</dt> |
||||||
|
<dd class="col-sm-10">@Model.UserCount</dd> |
||||||
|
|
||||||
|
<dt class="col-sm-2">Owners</dt> |
||||||
|
<dd class="col-sm-10">@(string.IsNullOrWhiteSpace(Model.Owners) ? "None" : Model.Owners)</dd> |
||||||
|
|
||||||
|
<dt class="col-sm-2">Admins</dt> |
||||||
|
<dd class="col-sm-10">@(string.IsNullOrWhiteSpace(Model.Admins) ? "None" : Model.Admins)</dd> |
||||||
|
|
||||||
|
<dt class="col-sm-2">Created</dt> |
||||||
|
<dd class="col-sm-10">@Model.Organization.CreationDate.ToString()</dd> |
||||||
|
|
||||||
|
<dt class="col-sm-2">Modified</dt> |
||||||
|
<dd class="col-sm-10">@Model.Organization.RevisionDate.ToString()</dd> |
||||||
|
</dl> |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
@model UserViewModel |
||||||
|
@{ |
||||||
|
ViewData["Title"] = "User: " + Model.User.Email; |
||||||
|
} |
||||||
|
|
||||||
|
<h1>User <small>@Model.User.Email</small></h1> |
||||||
|
|
||||||
|
<h2>Information</h2> |
||||||
|
@Html.Partial("_ViewInformation", Model) |
||||||
|
<form asp-action="Delete" asp-route-id="@Model.User.Id" |
||||||
|
onsubmit="return confirm('Are you sure you want to delete this user (@Model.User.Email)?')"> |
||||||
|
<button class="btn btn-danger" type="submit">Delete</button> |
||||||
|
</form> |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
@model UserViewModel |
||||||
|
<dl class="row"> |
||||||
|
<dt class="col-sm-2">Id</dt> |
||||||
|
<dd class="col-sm-10"><code>@Model.User.Id</code></dd> |
||||||
|
|
||||||
|
<dt class="col-sm-2">Items</dt> |
||||||
|
<dd class="col-sm-10">@Model.CipherCount</dd> |
||||||
|
|
||||||
|
<dt class="col-sm-2">Created</dt> |
||||||
|
<dd class="col-sm-10">@Model.User.CreationDate.ToString()</dd> |
||||||
|
|
||||||
|
<dt class="col-sm-2">Modified</dt> |
||||||
|
<dd class="col-sm-10">@Model.User.RevisionDate.ToString()</dd> |
||||||
|
|
||||||
|
<dt class="col-sm-2">Account Modified</dt> |
||||||
|
<dd class="col-sm-10">@Model.User.AccountRevisionDate.ToString()</dd> |
||||||
|
</dl> |
||||||
Loading…
Reference in new issue