mirror of
https://github.com/bitwarden/server.git
synced 2025-06-19 18:38:03 -05:00

* Auth/pm-48 (#2680) * PM-48 - add user's role as a claim and establish access control service * PM-48 - remove function unrelated to the role claim * PM-48 - fix whitespace issues * PM-48 - move registration of CustomClaimsPrincipalFactory, replace role claim type string with constant, streamline code that retrieves the user's role * Auth/pm-47 (#2699) * PM-48 - add user's role as a claim and establish access control service * PM-48 - remove function unrelated to the role claim * PM-48 - fix whitespace issues * PM-47 - add list of permission enums, role:permissions mapping, and function that determines if the logged in user has the given permission * PM-47 - remove unneeded service registration, set role to lowercase * PM-47 - fix code style issues * PM-46 - create permission filter attribute (#2753) * Auth/pm-54 add rbac for users (#2758) * PM-54 - add permission gates to User elements * PM-54 - fix formatting * PM-54 - remove unused function * PM-54 - fix variable reference, add permission to billing role * PM-54 - handle Upgrade Premium button functionality and fix spelling * PM-54 - change permission name to be more accurate * PM-49 - update role retrieval (#2779) * Auth/[PM-50] add rbac for logs (#2782) * PM-50 - add rbac for logs * PM-50 - remove unnecessary action filter * PM-51 - add RBAC for tools (#2799) * Auth/[pm-52] add rbac providers (#2818) * PM-52 add rbac for providers * PM-52 - update redirect action * PM-52 - add back edit functionality and permission * PM-52 - reverse changes around removing edit functionality * PM-52 - moved permission check to variable assignement * PM-53 - add rbac for organizations (#2798) * PM-52 - add missed permission to billing role (#2836) * Fixed merge conflicts. * [PM-1846] Updates to add RBAC back after merge conflicts (#2870) * Updates to add RBAC to changes from reseller. * Added back checks for delete and initiating a trial. * Removed extraneous Razor tag. --------- Co-authored-by: dgoodman-bw <109169446+dgoodman-bw@users.noreply.github.com> Co-authored-by: Danielle Goodman <dgoodman@bitwarden.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
61 lines
2.1 KiB
C#
61 lines
2.1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Bit.Core.Entities;
|
|
using Bit.Core.Models.Business;
|
|
using Bit.Core.Settings;
|
|
using Bit.Core.Utilities;
|
|
using Bit.Core.Vault.Entities;
|
|
|
|
namespace Bit.Admin.Models;
|
|
|
|
public class UserEditModel : UserViewModel
|
|
{
|
|
public UserEditModel() { }
|
|
|
|
public UserEditModel(User user, IEnumerable<Cipher> ciphers, BillingInfo billingInfo,
|
|
GlobalSettings globalSettings)
|
|
: base(user, ciphers)
|
|
{
|
|
BillingInfo = billingInfo;
|
|
BraintreeMerchantId = globalSettings.Braintree.MerchantId;
|
|
|
|
Name = user.Name;
|
|
Email = user.Email;
|
|
EmailVerified = user.EmailVerified;
|
|
Premium = user.Premium;
|
|
MaxStorageGb = user.MaxStorageGb;
|
|
Gateway = user.Gateway;
|
|
GatewayCustomerId = user.GatewayCustomerId;
|
|
GatewaySubscriptionId = user.GatewaySubscriptionId;
|
|
LicenseKey = user.LicenseKey;
|
|
PremiumExpirationDate = user.PremiumExpirationDate;
|
|
}
|
|
|
|
public BillingInfo BillingInfo { 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; }
|
|
|
|
[Display(Name = "Name")]
|
|
public string Name { get; set; }
|
|
[Required]
|
|
[Display(Name = "Email")]
|
|
public string Email { get; set; }
|
|
[Display(Name = "Email Verified")]
|
|
public bool EmailVerified { get; set; }
|
|
[Display(Name = "Premium")]
|
|
public bool Premium { get; set; }
|
|
[Display(Name = "Max. Storage GB")]
|
|
public short? MaxStorageGb { get; set; }
|
|
[Display(Name = "Gateway")]
|
|
public Core.Enums.GatewayType? Gateway { get; set; }
|
|
[Display(Name = "Gateway Customer Id")]
|
|
public string GatewayCustomerId { get; set; }
|
|
[Display(Name = "Gateway Subscription Id")]
|
|
public string GatewaySubscriptionId { get; set; }
|
|
[Display(Name = "License Key")]
|
|
public string LicenseKey { get; set; }
|
|
[Display(Name = "Premium Expiration Date")]
|
|
public DateTime? PremiumExpirationDate { get; set; }
|
|
|
|
}
|