improvement: address feedback

This commit is contained in:
Scott Wilson
2025-09-09 10:27:41 -07:00
parent 9ad8bc6977
commit b113eabeb7
+9 -13
View File
@@ -9,8 +9,10 @@ import {
ProjectMembershipRole, ProjectMembershipRole,
ProjectVersion, ProjectVersion,
TableName, TableName,
TOidcConfigs,
TProjectMemberships, TProjectMemberships,
TProjectUserMembershipRolesInsert, TProjectUserMembershipRolesInsert,
TSamlConfigs,
TUsers TUsers
} from "@app/db/schemas"; } from "@app/db/schemas";
import { TGroupDALFactory } from "@app/ee/services/group/group-dal"; import { TGroupDALFactory } from "@app/ee/services/group/group-dal";
@@ -449,16 +451,20 @@ export const orgServiceFactory = ({
}); });
} }
if (authEnforced) { let samlCfg: TSamlConfigs | undefined;
const samlCfg = await samlConfigDAL.findOne({ let oidcCfg: TOidcConfigs | undefined;
if (authEnforced || googleSsoAuthEnforced) {
samlCfg = await samlConfigDAL.findOne({
orgId, orgId,
isActive: true isActive: true
}); });
const oidcCfg = await oidcConfigDAL.findOne({ oidcCfg = await oidcConfigDAL.findOne({
orgId, orgId,
isActive: true isActive: true
}); });
}
if (authEnforced) {
if (!samlCfg && !oidcCfg) if (!samlCfg && !oidcCfg)
throw new NotFoundError({ throw new NotFoundError({
message: `SAML or OIDC configuration for organization with ID '${orgId}' not found` 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) { if (samlCfg) {
throw new BadRequestError({ throw new BadRequestError({
message: message:
@@ -498,11 +499,6 @@ export const orgServiceFactory = ({
}); });
} }
const oidcCfg = await oidcConfigDAL.findOne({
orgId,
isActive: true
});
if (oidcCfg) { if (oidcCfg) {
throw new BadRequestError({ throw new BadRequestError({
message: message: