mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-17 12:57:17 +00:00
fix: allow default IdP validation in global mode policies
This commit is contained in:
committed by
GitHub
parent
fec0fea766
commit
ad1c8113ea
@@ -207,8 +207,7 @@ export async function createResourcePolicy(
|
||||
const [provider] = await db
|
||||
.select()
|
||||
.from(idp)
|
||||
.innerJoin(idpOrg, eq(idpOrg.idpId, idp.idpId))
|
||||
.where(and(eq(idp.idpId, skipToIdpId), eq(idpOrg.orgId, orgId)))
|
||||
.where(eq(idp.idpId, skipToIdpId))
|
||||
.limit(1);
|
||||
|
||||
if (!provider) {
|
||||
@@ -219,6 +218,28 @@ export async function createResourcePolicy(
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (process.env.IDENTITY_PROVIDER_MODE === "org") {
|
||||
const [providerOrg] = await db
|
||||
.select()
|
||||
.from(idpOrg)
|
||||
.where(
|
||||
and(
|
||||
eq(idpOrg.idpId, skipToIdpId),
|
||||
eq(idpOrg.orgId, orgId)
|
||||
)
|
||||
)
|
||||
.limit(1);
|
||||
|
||||
if (!providerOrg) {
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.INTERNAL_SERVER_ERROR,
|
||||
"Identity provider not found in this organization"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const adminRole = await db
|
||||
|
||||
Reference in New Issue
Block a user