Fix tier matrix bugs

This commit is contained in:
Owen
2026-10-19 17:25:02 -04:00
parent 77d149a965
commit ec184cdf33
4 changed files with 14 additions and 63 deletions
@@ -8,8 +8,6 @@ import createHttpError from "http-errors";
import logger from "@server/logger";
import { fromError } from "zod-validation-error";
import { OpenAPITags, registry } from "@server/openApi";
import { isLicensedOrSubscribed } from "#private/lib/isLicencedOrSubscribed";
import { tierMatrix } from "@server/lib/billing/tierMatrix";
import {
MAX_MTLS_CERTIFICATES_PER_RESOURCE,
parseCaCertificates
@@ -120,19 +118,6 @@ export async function createResourceMtlsCertificate(
);
}
const isLicensed = await isLicensedOrSubscribed(
resource.orgId,
tierMatrix.mtls
);
if (!isLicensed) {
return next(
createHttpError(
HttpCode.FORBIDDEN,
"mTLS is not supported on your current plan. Please upgrade to access this feature."
)
);
}
let parsedCerts;
try {
parsedCerts = parseCaCertificates(certificate);
+7 -16
View File
@@ -534,23 +534,12 @@ async function updateHttpResource(
);
}
const isMtlsLicensed = await isLicensedOrSubscribed(
resource.orgId,
tierMatrix.mtls
);
if (!isMtlsLicensed) {
return next(
createHttpError(
HttpCode.FORBIDDEN,
"mTLS is not supported on your current plan. Please upgrade to access this feature."
)
);
}
const [{ certificateCount }] = await db
.select({ certificateCount: count() })
.from(resourceMtlsCertificates)
.where(eq(resourceMtlsCertificates.resourceId, resource.resourceId));
.where(
eq(resourceMtlsCertificates.resourceId, resource.resourceId)
);
if (certificateCount === 0) {
return next(
@@ -572,8 +561,10 @@ async function updateHttpResource(
}
// catch when the resource policy changes or gets cleared
if (updateData.resourcePolicyId !== undefined &&
resource.resourcePolicyId !== updateData.resourcePolicyId) {
if (
updateData.resourcePolicyId !== undefined &&
resource.resourcePolicyId !== updateData.resourcePolicyId
) {
await clearResourceSpecificSettings(
resource.resourceId,
resource.orgId,