mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-20 07:45:20 +00:00
dont early return on multi org
This commit is contained in:
@@ -336,31 +336,22 @@ export async function validateOidcCallback(
|
|||||||
.innerJoin(orgs, eq(orgs.orgId, idpOrg.orgId));
|
.innerJoin(orgs, eq(orgs.orgId, idpOrg.orgId));
|
||||||
allOrgs = idpOrgs.map((o) => o.orgs);
|
allOrgs = idpOrgs.map((o) => o.orgs);
|
||||||
|
|
||||||
// TODO: when there are multiple orgs we need to do this better!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
|
for (const org of allOrgs) {
|
||||||
if (allOrgs.length > 1) {
|
const subscribed = await isSubscribed(
|
||||||
// for some reason there is more than one org
|
org.orgId,
|
||||||
logger.error(
|
tierMatrix.autoProvisioning
|
||||||
"More than one organization linked to this IdP. This should not happen with auto-provisioning enabled."
|
|
||||||
);
|
);
|
||||||
return next(
|
if (!subscribed) {
|
||||||
createHttpError(
|
// filter out the org
|
||||||
HttpCode.INTERNAL_SERVER_ERROR,
|
allOrgs = allOrgs.filter((o) => o.orgId !== org.orgId);
|
||||||
"Multiple organizations linked to this IdP. Please contact support."
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const subscribed = await isSubscribed(
|
// return next(
|
||||||
allOrgs[0].orgId,
|
// createHttpError(
|
||||||
tierMatrix.autoProvisioning
|
// HttpCode.FORBIDDEN,
|
||||||
);
|
// "This organization's current plan does not support this feature."
|
||||||
if (!subscribed) {
|
// )
|
||||||
return next(
|
// );
|
||||||
createHttpError(
|
}
|
||||||
HttpCode.FORBIDDEN,
|
|
||||||
"This organization's current plan does not support this feature."
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
allOrgs = await db.select().from(orgs);
|
allOrgs = await db.select().from(orgs);
|
||||||
|
|||||||
Reference in New Issue
Block a user