Restore analytics access for the president, VP and directors - #25
Merged
Conversation
The Analytics page checked `isAdmin`, which was narrower than both the endpoint it guards and the Express-era route it replaced (`access !== "USER"` in App.jsx). EventsView offered a president the Analytics button and this line then redirected them to /profile when they clicked it. Both the page and the API now call `canViewFormAnalytics`, which holds the whole of the Express rule from controllers/forms/analytics.js: the role list, plus the address allowlist that moved into FORM_ANALYTICS_ALLOWED_EMAILS. Checked against the original controller over 18 roles and both email cases — no divergence. The role list had three hand-kept copies, which is how the button and the endpoint came to disagree in the first place. It is now one constant in lib/auth/roles.ts, imported by the permission set, the route and the button. DIRECTOR_SPONSORSHIP stays in the list although it is not an AccessTypes member and can never match; it was equally dead in Express, and dropping it would quietly change who qualifies. Also fixes four arguments passed one slot off to authCtx.login in CompleteProfile, which put `regForm` into `access`. Every account created through that path carried a role matching no list, so a member could be refused a permission their database record granted.
|
@Krishna-Das20 is attempting to deploy a commit to the fedkiitgmailcom's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
The Analytics page checked
isAdmin, which was narrower than both the endpoint it guards and the Express-era route it replaced (access !== "USER"in App.jsx). EventsView offered a president the Analytics button and this line then redirected them to /profile when they clicked it.Both the page and the API now call
canViewFormAnalytics, which holds the whole of the Express rule from controllers/forms/analytics.js: the role list, plus the address allowlist that moved into FORM_ANALYTICS_ALLOWED_EMAILS. Checked against the original controller over 18 roles and both email cases — no divergence.The role list had three hand-kept copies, which is how the button and the endpoint came to disagree in the first place. It is now one constant in lib/auth/roles.ts, imported by the permission set, the route and the button. DIRECTOR_SPONSORSHIP stays in the list although it is not an AccessTypes member and can never match; it was equally dead in Express, and dropping it would quietly change who qualifies.
Also fixes four arguments passed one slot off to authCtx.login in CompleteProfile, which put
regFormintoaccess. Every account created through that path carried a role matching no list, so a member could be refused a permission their database record granted.