Skip to content

Commit

Permalink
fix: Allow multiple kojo iams per jory iam
Browse files Browse the repository at this point in the history
  • Loading branch information
Veikkosuhonen committed Jan 23, 2025
1 parent 7e1ffbe commit 6bde10e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/auth/IAMConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ const kojoMap = {
'hy-oiktdk-ibl-jory': 'hy-oiktdk-maisteri-kojot',
'hy-oiktdk-ggl-jory': 'hy-oiktdk-maisteri-kojot',
'hy-ltdk-spk-jory': 'hy-ltdk-kandi-kojot',
'hy-ltdk-hll-jory': 'hy-ltdk-kandi-kojot',
'hy-ltdk-hll-jory': ['hy-ltdk-kandi-kojot', 'hy-ltdk-maisteri-kojot'],
'hy-ltdk-psyk-jory': 'hy-ltdk-maisteri-kojot',
'hy-ltdk-logo-jory': 'hy-ltdk-maisteri-kojot',
'hy-ltdk-ll-jory': 'hy-ltdk-maisteri-kojot',
'hy-ltdk-tmed-jory': 'hy-ltdk-maisteri-kojot',
'hy-ltdk-hll-jory': 'hy-ltdk-maisteri-kojot',
// 'hy-ltdk-hll-jory': 'hy-ltdk-maisteri-kojot',
'hy-ltdk-terv-jory': 'hy-ltdk-maisteri-kojot',
'hy-humtdk-filk-jory': 'hy-humtdk-kandi-kojot',
'hy-humtdk-ttk-jory': 'hy-humtdk-kandi-kojot',
Expand Down Expand Up @@ -478,8 +478,16 @@ const iamToDoctoralSchool = (iam) => doctoralSchoolMap[iam]

const getStudyLeaderGroup = (iam) => kojoMap[iam]

const isStudyLeaderGroup = (iam, allIams) =>
allIams.concat('ANY').includes(getStudyLeaderGroup(iam))
const isStudyLeaderGroup = (iam, allIams) => {
const kojoIam = getStudyLeaderGroup(iam)
return allIams.concat('ANY').some((iam) => {
if (Array.isArray(kojoIam)) {
return kojoIam.includes(iam)
} else {
return kojoIam === iam
}
})
}

const iamToOrganisationCode = (iam) => {
const organisationCodes = joryMap[iam]
Expand Down

0 comments on commit 6bde10e

Please sign in to comment.