mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-17 21:01:53 +00:00
fix: allow default IdP validation in global mode policies
This commit is contained in:
committed by
GitHub
parent
fec0fea766
commit
ad1c8113ea
@@ -74,13 +74,7 @@ export async function updateResourcePolicies(
|
||||
const [provider] = await trx
|
||||
.select()
|
||||
.from(idp)
|
||||
.innerJoin(idpOrg, eq(idpOrg.idpId, idp.idpId))
|
||||
.where(
|
||||
and(
|
||||
eq(idp.idpId, policyData["auto-login-idp"]),
|
||||
eq(idpOrg.orgId, orgId)
|
||||
)
|
||||
)
|
||||
.where(eq(idp.idpId, policyData["auto-login-idp"]))
|
||||
.limit(1);
|
||||
|
||||
if (!provider) {
|
||||
@@ -88,6 +82,25 @@ export async function updateResourcePolicies(
|
||||
`Identity provider not found for policy '${policyNiceId}' in this organization`
|
||||
);
|
||||
}
|
||||
|
||||
if (process.env.IDENTITY_PROVIDER_MODE === "org") {
|
||||
const [providerOrg] = await trx
|
||||
.select()
|
||||
.from(idpOrg)
|
||||
.where(
|
||||
and(
|
||||
eq(idpOrg.idpId, policyData["auto-login-idp"]),
|
||||
eq(idpOrg.orgId, orgId)
|
||||
)
|
||||
)
|
||||
.limit(1);
|
||||
|
||||
if (!providerOrg) {
|
||||
throw new Error(
|
||||
`Identity provider not found for policy '${policyNiceId}' in this organization`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Look up the admin role
|
||||
|
||||
Reference in New Issue
Block a user