From c7b86856fb4855314aea42b13409625adef8de12 Mon Sep 17 00:00:00 2001 From: Valtteri Kantanen Date: Thu, 28 Nov 2024 15:45:45 +0200 Subject: [PATCH] [Backend] Fix study guidance group fetching when the user has no sisPersonId --- services/backend/src/services/studyGuidanceGroups.ts | 2 +- services/backend/src/util/jami.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/backend/src/services/studyGuidanceGroups.ts b/services/backend/src/services/studyGuidanceGroups.ts index 4bd55472af..f0a9072c57 100644 --- a/services/backend/src/services/studyGuidanceGroups.ts +++ b/services/backend/src/services/studyGuidanceGroups.ts @@ -41,7 +41,7 @@ type StudyGuidanceGroup = { } const getGroupsFromImporter = async (sisPersonId: string) => { - if (!importerClient) { + if (!importerClient || !sisPersonId) { return [] } const answerTimeout = new Promise(resolve => setTimeout(resolve, 2000)) diff --git a/services/backend/src/util/jami.ts b/services/backend/src/util/jami.ts index 81519795f4..6fa39cc76a 100644 --- a/services/backend/src/util/jami.ts +++ b/services/backend/src/util/jami.ts @@ -26,10 +26,11 @@ export const getUserIamAccess = async ( return {} } try { + const getSisuAccess = !isStaging && sisPersonId != null && sisPersonId !== '' const { data: iamAccess } = await jamiClient.post('/', { userId: sisPersonId, iamGroups, - getSisuAccess: !isStaging, + getSisuAccess, }) const { specialGroup } = iamAccess as { specialGroup: Record } delete iamAccess.specialGroup