1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 23:52:50 -05:00

[EC-243] Grant premium status when member accepts org invite (#2043)

This commit is contained in:
Thomas Rittson
2022-06-17 06:30:50 +10:00
committed by GitHub
parent b2a0aa2860
commit 3360d40592
7 changed files with 73 additions and 14 deletions

View File

@ -15,7 +15,8 @@ namespace Bit.Api.Models.Response
IEnumerable<OrganizationUserOrganizationDetails> organizationsUserDetails,
IEnumerable<ProviderUserProviderDetails> providerUserDetails,
IEnumerable<ProviderUserOrganizationDetails> providerUserOrganizationDetails,
bool twoFactorEnabled) : base("profile")
bool twoFactorEnabled,
bool premiumFromOrganization) : base("profile")
{
if (user == null)
{
@ -27,6 +28,7 @@ namespace Bit.Api.Models.Response
Email = user.Email;
EmailVerified = user.EmailVerified;
Premium = user.Premium;
PremiumFromOrganization = premiumFromOrganization;
MasterPasswordHint = string.IsNullOrWhiteSpace(user.MasterPasswordHint) ? null : user.MasterPasswordHint;
Culture = user.Culture;
TwoFactorEnabled = twoFactorEnabled;
@ -46,6 +48,7 @@ namespace Bit.Api.Models.Response
public string Email { get; set; }
public bool EmailVerified { get; set; }
public bool Premium { get; set; }
public bool PremiumFromOrganization { get; set; }
public string MasterPasswordHint { get; set; }
public string Culture { get; set; }
public bool TwoFactorEnabled { get; set; }

View File

@ -16,6 +16,7 @@ namespace Bit.Api.Models.Response
GlobalSettings globalSettings,
User user,
bool userTwoFactorEnabled,
bool userHasPremiumFromOrganization,
IEnumerable<OrganizationUserOrganizationDetails> organizationUserDetails,
IEnumerable<ProviderUserProviderDetails> providerUserDetails,
IEnumerable<ProviderUserOrganizationDetails> providerUserOrganizationDetails,
@ -29,7 +30,7 @@ namespace Bit.Api.Models.Response
: base("sync")
{
Profile = new ProfileResponseModel(user, organizationUserDetails, providerUserDetails,
providerUserOrganizationDetails, userTwoFactorEnabled);
providerUserOrganizationDetails, userTwoFactorEnabled, userHasPremiumFromOrganization);
Folders = folders.Select(f => new FolderResponseModel(f));
Ciphers = ciphers.Select(c => new CipherDetailsResponseModel(c, globalSettings, collectionCiphersDict));
Collections = collections?.Select(