mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-13 05:16:37 +00:00
Grandfather in old users
This commit is contained in:
@@ -114,7 +114,10 @@ export async function createResource(
|
|||||||
|
|
||||||
const { orgId } = parsedParams.data;
|
const { orgId } = parsedParams.data;
|
||||||
|
|
||||||
if (req.user && (!req.userOrgRoleIds || req.userOrgRoleIds.length === 0)) {
|
if (
|
||||||
|
req.user &&
|
||||||
|
(!req.userOrgRoleIds || req.userOrgRoleIds.length === 0)
|
||||||
|
) {
|
||||||
return next(
|
return next(
|
||||||
createHttpError(HttpCode.FORBIDDEN, "User does not have a role")
|
createHttpError(HttpCode.FORBIDDEN, "User does not have a role")
|
||||||
);
|
);
|
||||||
@@ -195,10 +198,11 @@ async function createHttpResource(
|
|||||||
const subdomain = parsedBody.data.subdomain;
|
const subdomain = parsedBody.data.subdomain;
|
||||||
const stickySession = parsedBody.data.stickySession;
|
const stickySession = parsedBody.data.stickySession;
|
||||||
|
|
||||||
if (
|
if (build == "saas" && !isSubscribed(orgId!, tierMatrix.domainNamespaces)) {
|
||||||
build == "saas" &&
|
// grandfather in existing users
|
||||||
!isSubscribed(orgId!, tierMatrix.domainNamespaces)
|
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
|
// check if this domain id is a namespace domain and if so, reject
|
||||||
const domain = await db
|
const domain = await db
|
||||||
.select()
|
.select()
|
||||||
@@ -215,6 +219,7 @@ async function createHttpResource(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Validate domain and construct full domain
|
// Validate domain and construct full domain
|
||||||
const domainResult = await validateAndConstructDomain(
|
const domainResult = await validateAndConstructDomain(
|
||||||
|
|||||||
@@ -121,7 +121,9 @@ const updateHttpResourceBodySchema = z
|
|||||||
if (data.headers) {
|
if (data.headers) {
|
||||||
// HTTP header values must be visible ASCII or horizontal whitespace, no control chars (RFC 7230)
|
// HTTP header values must be visible ASCII or horizontal whitespace, no control chars (RFC 7230)
|
||||||
const validHeaderValue = /^[\t\x20-\x7E]*$/;
|
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;
|
return true;
|
||||||
},
|
},
|
||||||
@@ -323,6 +325,12 @@ async function updateHttpResource(
|
|||||||
build == "saas" &&
|
build == "saas" &&
|
||||||
!isSubscribed(resource.orgId, tierMatrix.domainNamespaces)
|
!isSubscribed(resource.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
|
// check if this domain id is a namespace domain and if so, reject
|
||||||
const domain = await db
|
const domain = await db
|
||||||
.select()
|
.select()
|
||||||
@@ -339,6 +347,7 @@ async function updateHttpResource(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Validate domain and construct full domain
|
// Validate domain and construct full domain
|
||||||
const domainResult = await validateAndConstructDomain(
|
const domainResult = await validateAndConstructDomain(
|
||||||
|
|||||||
Reference in New Issue
Block a user