mirror of
https://github.com/bitwarden/server
synced 2025-12-27 13:43:18 +00:00
user/org view pages
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
@@ -10,17 +9,14 @@ using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Admin.Models
|
||||
{
|
||||
public class OrganizationEditModel
|
||||
public class OrganizationEditModel : OrganizationViewModel
|
||||
{
|
||||
public OrganizationEditModel() { }
|
||||
|
||||
public OrganizationEditModel(Organization org, IEnumerable<OrganizationUserUserDetails> orgUsers,
|
||||
GlobalSettings globalSettings)
|
||||
: base(org, 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));
|
||||
BraintreeMerchantId = globalSettings.Braintree.MerchantId;
|
||||
|
||||
Name = org.Name;
|
||||
@@ -50,10 +46,6 @@ namespace Bit.Admin.Models
|
||||
ExpirationDate = org.ExpirationDate;
|
||||
}
|
||||
|
||||
public Organization Organization { get; set; }
|
||||
public string Owners { get; set; }
|
||||
public string Admins { get; set; }
|
||||
public int UserCount { get; set; }
|
||||
public string RandomLicenseKey => CoreHelpers.SecureRandomString(20);
|
||||
public string FourteenDayExpirationDate => DateTime.Now.AddDays(14).ToString("yyyy-MM-ddTHH:mm");
|
||||
public string BraintreeMerchantId { get; set; }
|
||||
|
||||
27
src/Admin/Models/OrganizationViewModel.cs
Normal file
27
src/Admin/Models/OrganizationViewModel.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,13 @@ using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Admin.Models
|
||||
{
|
||||
public class UserEditModel
|
||||
public class UserEditModel : UserViewModel
|
||||
{
|
||||
public UserEditModel() { }
|
||||
|
||||
public UserEditModel(User user, IEnumerable<Cipher> ciphers, GlobalSettings globalSettings)
|
||||
: base(user, ciphers)
|
||||
{
|
||||
User = user;
|
||||
CipherCount = ciphers.Count();
|
||||
BraintreeMerchantId = globalSettings.Braintree.MerchantId;
|
||||
|
||||
Name = user.Name;
|
||||
@@ -30,8 +29,6 @@ namespace Bit.Admin.Models
|
||||
PremiumExpirationDate = user.PremiumExpirationDate;
|
||||
}
|
||||
|
||||
public User User { get; set; }
|
||||
public int CipherCount { get; set; }
|
||||
public string RandomLicenseKey => CoreHelpers.SecureRandomString(20);
|
||||
public string OneYearExpirationDate => DateTime.Now.AddYears(1).ToString("yyyy-MM-ddTHH:mm");
|
||||
public string BraintreeMerchantId { get; set; }
|
||||
|
||||
21
src/Admin/Models/UserViewModel.cs
Normal file
21
src/Admin/Models/UserViewModel.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user