diff --git a/server/routers/resource/createResource.ts b/server/routers/resource/createResource.ts index e94a5fc10..d8820de79 100644 --- a/server/routers/resource/createResource.ts +++ b/server/routers/resource/createResource.ts @@ -114,7 +114,10 @@ export async function createResource( const { orgId } = parsedParams.data; - if (req.user && (!req.userOrgRoleIds || req.userOrgRoleIds.length === 0)) { + if ( + req.user && + (!req.userOrgRoleIds || req.userOrgRoleIds.length === 0) + ) { return next( createHttpError(HttpCode.FORBIDDEN, "User does not have a role") ); @@ -195,24 +198,26 @@ async function createHttpResource( const subdomain = parsedBody.data.subdomain; const stickySession = parsedBody.data.stickySession; - if ( - build == "saas" && - !isSubscribed(orgId!, tierMatrix.domainNamespaces) - ) { - // check if this domain id is a namespace domain and if so, reject - const domain = await db - .select() - .from(domainNamespaces) - .where(eq(domainNamespaces.domainId, domainId)) - .limit(1); + if (build == "saas" && !isSubscribed(orgId!, tierMatrix.domainNamespaces)) { + // grandfather in existing users + const lastAllowedDate = new Date("2026-04-12"); + const userCreatedDate = new Date(req.user?.dateCreated || new Date()); + if (userCreatedDate > lastAllowedDate) { + // check if this domain id is a namespace domain and if so, reject + const domain = await db + .select() + .from(domainNamespaces) + .where(eq(domainNamespaces.domainId, domainId)) + .limit(1); - if (domain.length > 0) { - return next( - createHttpError( - HttpCode.BAD_REQUEST, - "Your current subscription does not support custom domain namespaces. Please upgrade to access this feature." - ) - ); + if (domain.length > 0) { + return next( + createHttpError( + HttpCode.BAD_REQUEST, + "Your current subscription does not support custom domain namespaces. Please upgrade to access this feature." + ) + ); + } } } diff --git a/server/routers/resource/updateResource.ts b/server/routers/resource/updateResource.ts index 8a2df18c3..07e566194 100644 --- a/server/routers/resource/updateResource.ts +++ b/server/routers/resource/updateResource.ts @@ -121,7 +121,9 @@ const updateHttpResourceBodySchema = z if (data.headers) { // HTTP header values must be visible ASCII or horizontal whitespace, no control chars (RFC 7230) const validHeaderValue = /^[\t\x20-\x7E]*$/; - return data.headers.every((h) => validHeaderValue.test(h.value)); + return data.headers.every((h) => + validHeaderValue.test(h.value) + ); } return true; }, @@ -323,20 +325,27 @@ async function updateHttpResource( build == "saas" && !isSubscribed(resource.orgId, tierMatrix.domainNamespaces) ) { - // check if this domain id is a namespace domain and if so, reject - const domain = await db - .select() - .from(domainNamespaces) - .where(eq(domainNamespaces.domainId, domainId)) - .limit(1); + // grandfather in existing users + const lastAllowedDate = new Date("2026-04-12"); + const userCreatedDate = new Date( + req.user?.dateCreated || new Date() + ); + if (userCreatedDate > lastAllowedDate) { + // check if this domain id is a namespace domain and if so, reject + const domain = await db + .select() + .from(domainNamespaces) + .where(eq(domainNamespaces.domainId, domainId)) + .limit(1); - if (domain.length > 0) { - return next( - createHttpError( - HttpCode.BAD_REQUEST, - "Your current subscription does not support custom domain namespaces. Please upgrade to access this feature." - ) - ); + if (domain.length > 0) { + return next( + createHttpError( + HttpCode.BAD_REQUEST, + "Your current subscription does not support custom domain namespaces. Please upgrade to access this feature." + ) + ); + } } }