Browse Source

[PM-28249] Write `PlanType` claim as an integer (#6610)

* Write PlanType claim as an integer

* Accept FamiliesAnnually2025 for FamiliesAnnually plan type
v2025.11.1
Alex Morask 4 weeks ago committed by Alex Morask
parent
commit
62d6371685
No known key found for this signature in database
GPG Key ID: 23E38285B743E3A8
  1. 2
      src/Core/Billing/Licenses/Services/Implementations/OrganizationLicenseClaimsFactory.cs
  2. 9
      src/Core/Billing/Organizations/Models/OrganizationLicense.cs

2
src/Core/Billing/Licenses/Services/Implementations/OrganizationLicenseClaimsFactory.cs

@ -26,7 +26,7 @@ public class OrganizationLicenseClaimsFactory : ILicenseClaimsFactory<Organizati @@ -26,7 +26,7 @@ public class OrganizationLicenseClaimsFactory : ILicenseClaimsFactory<Organizati
new(nameof(OrganizationLicenseConstants.LicenseType), LicenseType.Organization.ToString()),
new(nameof(OrganizationLicenseConstants.Id), entity.Id.ToString()),
new(nameof(OrganizationLicenseConstants.Enabled), entity.Enabled.ToString()),
new(nameof(OrganizationLicenseConstants.PlanType), entity.PlanType.ToString()),
new(nameof(OrganizationLicenseConstants.PlanType), ((int)entity.PlanType).ToString()),
new(nameof(OrganizationLicenseConstants.UsePolicies), entity.UsePolicies.ToString()),
new(nameof(OrganizationLicenseConstants.UseSso), entity.UseSso.ToString()),
new(nameof(OrganizationLicenseConstants.UseKeyConnector), entity.UseKeyConnector.ToString()),

9
src/Core/Billing/Organizations/Models/OrganizationLicense.cs

@ -399,7 +399,6 @@ public class OrganizationLicense : ILicense @@ -399,7 +399,6 @@ public class OrganizationLicense : ILicense
var installationId = claimsPrincipal.GetValue<Guid>(nameof(InstallationId));
var licenseKey = claimsPrincipal.GetValue<string>(nameof(LicenseKey));
var enabled = claimsPrincipal.GetValue<bool>(nameof(Enabled));
var planType = claimsPrincipal.GetValue<PlanType>(nameof(PlanType));
var seats = claimsPrincipal.GetValue<int?>(nameof(Seats));
var maxCollections = claimsPrincipal.GetValue<short?>(nameof(MaxCollections));
var useGroups = claimsPrincipal.GetValue<bool>(nameof(UseGroups));
@ -425,12 +424,18 @@ public class OrganizationLicense : ILicense @@ -425,12 +424,18 @@ public class OrganizationLicense : ILicense
var useOrganizationDomains = claimsPrincipal.GetValue<bool>(nameof(UseOrganizationDomains));
var useAutomaticUserConfirmation = claimsPrincipal.GetValue<bool>(nameof(UseAutomaticUserConfirmation));
var claimedPlanType = claimsPrincipal.GetValue<PlanType>(nameof(PlanType));
var planTypesMatch = claimedPlanType == PlanType.FamiliesAnnually
? organization.PlanType is PlanType.FamiliesAnnually or PlanType.FamiliesAnnually2025
: organization.PlanType == claimedPlanType;
return issued <= DateTime.UtcNow &&
expires >= DateTime.UtcNow &&
installationId == globalSettings.Installation.Id &&
licenseKey == organization.LicenseKey &&
enabled == organization.Enabled &&
planType == organization.PlanType &&
planTypesMatch &&
seats == organization.Seats &&
maxCollections == organization.MaxCollections &&
useGroups == organization.UseGroups &&

Loading…
Cancel
Save