Repository navigation
Sireesha - questionnaire to users invited through the Dropbox process - #2428
Open
kunchalasireesha wants to merge 2 commits into
Open
kunchalasireesha wants to merge 2 commits into
kunchalasireesha wants to merge 2 commits into
Conversation
…opbox process Add GET /api/hgnform/access so the permanent questionnaire link can check whether the logged-in user was invited to Dropbox, and apply the same check when submitting the questionnaire. Document the permanent link for onboarding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only an invite into the Highest Good Network Team Dropbox folder now unlocks the HGN Questionnaire. Invites into the Administration Team folder do not. - Record teamFolderKey on the Dropbox applicationAccess entry when inviting - Require teamFolderKey 'HGN' in the questionnaire access check, with a new NOT_HGN_TEAM_FOLDER reason - For invites made before teamFolderKey existed, look up the folder in Dropbox once and save the key - Add integration tests (in-memory MongoDB) and team folder lookup tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Implements: HGN Questionnaire Dashboard – Create a Permanent Questionnaire Link with Access Restrictions.
The frontend adds a permanent, reusable link to the HGN questionnaire (
/questionnaire). This PR adds the backend check behind that link: the questionnaire is only available to people who were set up and invited through the HGN Dropbox process (User Profile → Access Management → Dropbox → Invite). The same check now applies when the questionnaire is submitted, so the restriction cannot be bypassed by calling the API directly.Related PRS (if any):
This backend PR is related to the frontend PR.
To test this backend PR you need to checkout the #XXX frontend PR.
…
Main changes explained:
src/helpers/questionnaireAccessHelper.js: decides whether a user can open the questionnaire. Eligible means an active user whoseapplicationAccessrecord hasapp: 'dropbox'withstatus: 'invited', the record the existing Dropbox invite already writes. Owners are always allowed, so they can preview the form.src/controllers/hgnFormResponseController.js:getAccess, which returns{ eligible, reason }for the logged-in user.reasonis one ofNOT_LOGGED_IN,USER_NOT_FOUND,INACTIVE,NOT_INVITEDorACCESS_REVOKED.submitFormResponsenow returns403if the user is not eligible, or if a non-Owner submits a response with someone else'suser_id.src/routes/hgnFormResponseRouter.js: addGET /api/hgnform/access.src/helpers/questionnaireAccessHelper.spec.jsand updatehgnFormResponseController.test.js(new tests for access, the 403 cases, and the new endpoint).docs/HGN_QUESTIONNAIRE_LINK.md: onboarding steps and the permanent link, for the onboarding documentation.…
How to test:
npm installandnpm run devhere; start the frontend.GET /api/hgnform/access→ expect{ "eligible": false, "reason": "NOT_INVITED" }.GET /api/hgnform/accessreturns{ "eligible": true, ... }.201. Revoke the user's Dropbox access → submitting returns403.eligible: truewith no Dropbox invite.npx jest src/helpers/questionnaireAccessHelper.spec.js src/controllers/hgnFormResponseController.test.js.Screenshots or videos of changes:
See the frontend PR OneCommunityGlobal/HighestGoodNetworkApp#5702

for screen recordings
Note:
No schema changes. The check reads the existing
applicationAccesscollection./api/hgnform/accessendpoint.docs/is in.gitignore, so the doc file was force-added (same asdocs/BADGE_ASSIGN_API.md).BYPASS_ROLESin the helper, in case reviewers prefer no exceptions.