mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
Add sponsorship available boolean to orgDetails
This commit is contained in:
@ -39,6 +39,9 @@ namespace Bit.Core.Models.Api
|
|||||||
ProviderId = organization.ProviderId?.ToString();
|
ProviderId = organization.ProviderId?.ToString();
|
||||||
ProviderName = organization.ProviderName;
|
ProviderName = organization.ProviderName;
|
||||||
FamilySponsorshipFriendlyName = organization.FamilySponsorshipFriendlyName;
|
FamilySponsorshipFriendlyName = organization.FamilySponsorshipFriendlyName;
|
||||||
|
FamilySponsorshipAvailable = FamilySponsorshipFriendlyName == null &&
|
||||||
|
Utilities.StaticStore.GetSponsoredPlan(PlanSponsorshipType.FamiliesForEnterprise)
|
||||||
|
.UsersCanSponsor(organization);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
@ -70,5 +73,6 @@ namespace Bit.Core.Models.Api
|
|||||||
public string ProviderId { get; set; }
|
public string ProviderId { get; set; }
|
||||||
public string ProviderName { get; set; }
|
public string ProviderName { get; set; }
|
||||||
public string FamilySponsorshipFriendlyName { get; set; }
|
public string FamilySponsorshipFriendlyName { get; set; }
|
||||||
|
public bool FamilySponsorshipAvailable { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ namespace Bit.Core.Models.Data
|
|||||||
public Enums.OrganizationUserStatusType Status { get; set; }
|
public Enums.OrganizationUserStatusType Status { get; set; }
|
||||||
public Enums.OrganizationUserType Type { get; set; }
|
public Enums.OrganizationUserType Type { get; set; }
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
|
public Enums.PlanType PlanType { get; set; }
|
||||||
public string SsoExternalId { get; set; }
|
public string SsoExternalId { get; set; }
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
public string Permissions { get; set; }
|
public string Permissions { get; set; }
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
using System;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
|
using Bit.Core.Models.Data;
|
||||||
|
|
||||||
namespace Bit.Core.Models.StaticStore
|
namespace Bit.Core.Models.StaticStore
|
||||||
{
|
{
|
||||||
@ -8,5 +10,6 @@ namespace Bit.Core.Models.StaticStore
|
|||||||
public ProductType SponsoredProductType { get; set; }
|
public ProductType SponsoredProductType { get; set; }
|
||||||
public ProductType SponsoringProductType { get; set; }
|
public ProductType SponsoringProductType { get; set; }
|
||||||
public string StripePlanId { get; set; }
|
public string StripePlanId { get; set; }
|
||||||
|
public Func<OrganizationUserOrganizationDetails, bool> UsersCanSponsor { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ namespace Bit.Core.Repositories.EntityFramework.Queries
|
|||||||
UserId = x.ou.UserId,
|
UserId = x.ou.UserId,
|
||||||
Name = x.o.Name,
|
Name = x.o.Name,
|
||||||
Enabled = x.o.Enabled,
|
Enabled = x.o.Enabled,
|
||||||
|
PlanType = x.o.PlanType,
|
||||||
UsePolicies = x.o.UsePolicies,
|
UsePolicies = x.o.UsePolicies,
|
||||||
UseSso = x.o.UseSso,
|
UseSso = x.o.UseSso,
|
||||||
UseGroups = x.o.UseGroups,
|
UseGroups = x.o.UseGroups,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
|
using Bit.Core.Models.Data;
|
||||||
using Bit.Core.Models.StaticStore;
|
using Bit.Core.Models.StaticStore;
|
||||||
using Bit.Core.Models.Table;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@ -484,7 +484,9 @@ namespace Bit.Core.Utilities
|
|||||||
PlanSponsorshipType = PlanSponsorshipType.FamiliesForEnterprise,
|
PlanSponsorshipType = PlanSponsorshipType.FamiliesForEnterprise,
|
||||||
SponsoredProductType = ProductType.Families,
|
SponsoredProductType = ProductType.Families,
|
||||||
SponsoringProductType = ProductType.Enterprise,
|
SponsoringProductType = ProductType.Enterprise,
|
||||||
StripePlanId = "2021-enterprise-sponsored-families-org-monthly"
|
StripePlanId = "2021-enterprise-sponsored-families-org-monthly",
|
||||||
|
UsersCanSponsor = (OrganizationUserOrganizationDetails org) =>
|
||||||
|
GetPlan(org.PlanType).Product == ProductType.Enterprise,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static Plan GetPlan(PlanType planType) =>
|
public static Plan GetPlan(PlanType planType) =>
|
||||||
|
@ -622,6 +622,7 @@ SELECT
|
|||||||
OU.[OrganizationId],
|
OU.[OrganizationId],
|
||||||
O.[Name],
|
O.[Name],
|
||||||
O.[Enabled],
|
O.[Enabled],
|
||||||
|
O.[PlanType],
|
||||||
O.[UsePolicies],
|
O.[UsePolicies],
|
||||||
O.[UseSso],
|
O.[UseSso],
|
||||||
O.[UseGroups],
|
O.[UseGroups],
|
||||||
|
Reference in New Issue
Block a user