improvement: address feedback

This commit is contained in:
Scott Wilson
2025-09-09 10:27:41 -07:00
parent 9ad8bc6977
commit b113eabeb7

View File

@@ -9,8 +9,10 @@ import {
ProjectMembershipRole,
ProjectVersion,
TableName,
TOidcConfigs,
TProjectMemberships,
TProjectUserMembershipRolesInsert,
TSamlConfigs,
TUsers
} from "@app/db/schemas";
import { TGroupDALFactory } from "@app/ee/services/group/group-dal";
@@ -449,16 +451,20 @@ export const orgServiceFactory = ({
});
}
if (authEnforced) {
const samlCfg = await samlConfigDAL.findOne({
let samlCfg: TSamlConfigs | undefined;
let oidcCfg: TOidcConfigs | undefined;
if (authEnforced || googleSsoAuthEnforced) {
samlCfg = await samlConfigDAL.findOne({
orgId,
isActive: true
});
const oidcCfg = await oidcConfigDAL.findOne({
oidcCfg = await oidcConfigDAL.findOne({
orgId,
isActive: true
});
}
if (authEnforced) {
if (!samlCfg && !oidcCfg)
throw new NotFoundError({
message: `SAML or OIDC configuration for organization with ID '${orgId}' not found`
@@ -486,11 +492,6 @@ export const orgServiceFactory = ({
});
}
const samlCfg = await samlConfigDAL.findOne({
orgId,
isActive: true
});
if (samlCfg) {
throw new BadRequestError({
message:
@@ -498,11 +499,6 @@ export const orgServiceFactory = ({
});
}
const oidcCfg = await oidcConfigDAL.findOne({
orgId,
isActive: true
});
if (oidcCfg) {
throw new BadRequestError({
message: