Updated checkLicense

pull/9078/head
zomars 2023-02-08 10:55:46 -07:00
parent 3ebab100ce
commit 0b2724124a
1 changed files with 2 additions and 2 deletions

View File

@ -15,10 +15,10 @@ export const dateNotInPast = function (date: Date) {
// This verifies the apiKey and sets the user if it is valid.
export const verifyApiKey: NextMiddleware = async (req, res, next) => {
const hasValidLicense = await checkLicense(process.env.CALCOM_LICENSE_KEY || "");
const { prisma, isCustomPrisma, isAdmin } = req;
const hasValidLicense = await checkLicense(prisma);
if (!hasValidLicense)
return res.status(401).json({ error: "Invalid or missing CALCOM_LICENSE_KEY environment variable" });
const { prisma, isCustomPrisma, isAdmin } = req;
// If the user is an admin and using a license key (from customPrisma), skip the apiKey check.
if (isCustomPrisma && isAdmin) {
await next();