Restrict license

This commit is contained in:
Owen
2025-11-13 21:11:05 -05:00
committed by Owen Schwartz
parent bb5594ab2f
commit d8344988c0
3 changed files with 37 additions and 23 deletions

View File

@@ -0,0 +1,23 @@
import { build } from "@server/build";
import license from "@server/license/license";
import { getOrgTierData } from "#dynamic/lib/billing";
import { TierId } from "./billing/tiers";
export async function isLicensedOrSubscribed(orgId: string): Promise<boolean> {
if (build === "enterprise") {
const isUnlocked = await license.isUnlocked();
if (!isUnlocked) {
return false;
}
}
if (build === "saas") {
const { tier } = await getOrgTierData(orgId);
const subscribed = tier === TierId.STANDARD;
if (!subscribed) {
return false;
}
}
return true;
}