From b70f8de343cbe8d90b8e6799f4bcabbb8c252ad2 Mon Sep 17 00:00:00 2001 From: Jason Sherman Date: Wed, 28 Feb 2024 13:44:11 -0800 Subject: [PATCH] filtering on idp/Hint vs code Signed-off-by: Jason Sherman --- .devcontainer/devcontainer.json | 8 ++++++-- .devcontainer/post-install.sh | 1 + app/src/forms/auth/service.js | 4 ++-- app/src/forms/form/service.js | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6f7cebd58..f0ce7abf1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -48,8 +48,12 @@ "editor.formatOnSave": true } } - } + }, // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - //"remoteUser": "root" + //"remoteUser": "root", + + "containerEnv": { + "NODE_CONFIG_DIR": "${containerWorkspaceFolder}/.devcontainer/chefs_local" + } } diff --git a/.devcontainer/post-install.sh b/.devcontainer/post-install.sh index 891641159..46eec3560 100644 --- a/.devcontainer/post-install.sh +++ b/.devcontainer/post-install.sh @@ -6,6 +6,7 @@ WORKSPACE_DIR=$(pwd) CHEFS_LOCAL_DIR=${WORKSPACE_DIR}/.devcontainer/chefs_local npm install knex -g +npm install jest -g # install app libraries, prepare for app development and debugging... cd app diff --git a/app/src/forms/auth/service.js b/app/src/forms/auth/service.js index e7c98ddb4..9f3caa71a 100644 --- a/app/src/forms/auth/service.js +++ b/app/src/forms/auth/service.js @@ -113,7 +113,7 @@ const service = { let forms = []; let filtered = items.filter((x) => { // include if user has idp, or form is public, or user has an explicit role. - if (x.idps.includes(userInfo.idp) || x.idps.includes('public')) { + if (x.idps.includes(userInfo.idpHint) || x.idps.includes('public')) { // always give submitter permissions to launch by idp and public x.permissions = Array.from(new Set([...x.permissions, ...FORM_SUBMITTER])); return true; @@ -132,7 +132,7 @@ const service = { hasPublic = item.idps.includes('public'); } else if (accessLevels.includes('idp')) { // must have user's idp in idps... - hasIdp = item.idps.includes(userInfo.idp); + hasIdp = item.idps.includes(userInfo.idpHint); } else if (accessLevels.includes('team')) { // must have a role... hasTeam = item.roles.length; diff --git a/app/src/forms/form/service.js b/app/src/forms/form/service.js index 01ad71249..a255265fb 100644 --- a/app/src/forms/form/service.js +++ b/app/src/forms/form/service.js @@ -238,7 +238,7 @@ const service = { .withGraphFetched('idpHints') .throwIfNotFound() .then((form) => { - form.idpHints = form.idpHints.map((idp) => idp.code); + form.idpHints = form.idpHints.map((idp) => idp.idp); return form; }); },