Skip to content

Commit 62d6371

Browse files
[PM-28249] Write PlanType claim as an integer (#6610)
* Write PlanType claim as an integer * Accept FamiliesAnnually2025 for FamiliesAnnually plan type
1 parent 688b851 commit 62d6371

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public Task<List<Claim>> GenerateClaims(Organization entity, LicenseContext lice
2626
new(nameof(OrganizationLicenseConstants.LicenseType), LicenseType.Organization.ToString()),
2727
new(nameof(OrganizationLicenseConstants.Id), entity.Id.ToString()),
2828
new(nameof(OrganizationLicenseConstants.Enabled), entity.Enabled.ToString()),
29-
new(nameof(OrganizationLicenseConstants.PlanType), entity.PlanType.ToString()),
29+
new(nameof(OrganizationLicenseConstants.PlanType), ((int)entity.PlanType).ToString()),
3030
new(nameof(OrganizationLicenseConstants.UsePolicies), entity.UsePolicies.ToString()),
3131
new(nameof(OrganizationLicenseConstants.UseSso), entity.UseSso.ToString()),
3232
new(nameof(OrganizationLicenseConstants.UseKeyConnector), entity.UseKeyConnector.ToString()),

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ public bool VerifyData(
399399
var installationId = claimsPrincipal.GetValue<Guid>(nameof(InstallationId));
400400
var licenseKey = claimsPrincipal.GetValue<string>(nameof(LicenseKey));
401401
var enabled = claimsPrincipal.GetValue<bool>(nameof(Enabled));
402-
var planType = claimsPrincipal.GetValue<PlanType>(nameof(PlanType));
403402
var seats = claimsPrincipal.GetValue<int?>(nameof(Seats));
404403
var maxCollections = claimsPrincipal.GetValue<short?>(nameof(MaxCollections));
405404
var useGroups = claimsPrincipal.GetValue<bool>(nameof(UseGroups));
@@ -425,12 +424,18 @@ public bool VerifyData(
425424
var useOrganizationDomains = claimsPrincipal.GetValue<bool>(nameof(UseOrganizationDomains));
426425
var useAutomaticUserConfirmation = claimsPrincipal.GetValue<bool>(nameof(UseAutomaticUserConfirmation));
427426

427+
var claimedPlanType = claimsPrincipal.GetValue<PlanType>(nameof(PlanType));
428+
429+
var planTypesMatch = claimedPlanType == PlanType.FamiliesAnnually
430+
? organization.PlanType is PlanType.FamiliesAnnually or PlanType.FamiliesAnnually2025
431+
: organization.PlanType == claimedPlanType;
432+
428433
return issued <= DateTime.UtcNow &&
429434
expires >= DateTime.UtcNow &&
430435
installationId == globalSettings.Installation.Id &&
431436
licenseKey == organization.LicenseKey &&
432437
enabled == organization.Enabled &&
433-
planType == organization.PlanType &&
438+
planTypesMatch &&
434439
seats == organization.Seats &&
435440
maxCollections == organization.MaxCollections &&
436441
useGroups == organization.UseGroups &&

0 commit comments

Comments
 (0)