From 1086daf87cbfc38e32e61b041484ea09ae494973 Mon Sep 17 00:00:00 2001 From: Samuel Hassine Date: Sat, 16 Nov 2024 11:32:32 +0100 Subject: [PATCH] [backend] Fix SAML organization mappings (#9042) --- opencti-platform/opencti-graphql/src/config/providers.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/opencti-platform/opencti-graphql/src/config/providers.js b/opencti-platform/opencti-graphql/src/config/providers.js index 93190c41846a..b24c96c9b348 100644 --- a/opencti-platform/opencti-graphql/src/config/providers.js +++ b/opencti-platform/opencti-graphql/src/config/providers.js @@ -267,12 +267,8 @@ for (let i = 0; i < providerKeys.length; i += 1) { const orgaDefault = mappedConfig.organizations_default ?? []; const orgasMapping = mappedConfig.organizations_management?.organizations_mapping || []; const orgaPath = mappedConfig.organizations_management?.organizations_path || ['organizations']; - const availableOrgas = R.flatten( - orgaPath.map((path) => { - const value = R.path(path.split('.'), profile) || []; - return Array.isArray(value) ? value : [value]; - }) - ); + const samlOrgas = R.path(orgaPath, profile) || []; + const availableOrgas = Array.isArray(samlOrgas) ? samlOrgas : [samlOrgas]; const orgasMapper = genConfigMapper(orgasMapping); return [...orgaDefault, ...availableOrgas.map((a) => orgasMapper[a]).filter((r) => isNotEmptyField(r))]; };