Skip to content

Commit

Permalink
Merge branch 'main' into renovate/aws-sdk-net-monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
djsmith85 authored Dec 16, 2024
2 parents 510fddb + d0c72a3 commit 7ba4c35
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ jobs:
ref: 'main',
inputs: {
server_branch: process.env.GITHUB_REF
is_workflow_call: true
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,17 +519,29 @@ private async Task ValidateSignUpPoliciesAsync(Guid ownerId)
OrganizationLicense license, User owner, string ownerKey, string collectionName, string publicKey,
string privateKey)
{
if (license.LicenseType != LicenseType.Organization)
{
throw new BadRequestException("Premium licenses cannot be applied to an organization. " +
"Upload this license from your personal account settings page.");
}

var claimsPrincipal = _licensingService.GetClaimsPrincipalFromLicense(license);
var canUse = license.CanUse(_globalSettings, _licensingService, claimsPrincipal, out var exception);

if (!canUse)
{
throw new BadRequestException(exception);
}

if (license.PlanType != PlanType.Custom &&
StaticStore.Plans.FirstOrDefault(p => p.Type == license.PlanType && !p.Disabled) == null)
var plan = StaticStore.Plans.FirstOrDefault(p => p.Type == license.PlanType);
if (plan is null)
{
throw new BadRequestException("Plan not found.");
throw new BadRequestException($"Server must be updated to support {license.Plan}.");
}

if (license.PlanType != PlanType.Custom && plan.Disabled)
{
throw new BadRequestException($"Plan {plan.Name} is disabled.");
}

var enabledOrgs = await _organizationRepository.GetManyByEnabledAsync();
Expand Down

0 comments on commit 7ba4c35

Please sign in to comment.