Skip to content

Restore analytics access for the president, VP and directors - #25

Merged
fed-tech merged 1 commit into
fed-tech:mainfrom
Krishna-Das20:main
Aug 10, 2026
Merged

Restore analytics access for the president, VP and directors#25
fed-tech merged 1 commit into
fed-tech:mainfrom
Krishna-Das20:main

Conversation

@Krishna-Das20

Copy link
Copy Markdown
Collaborator

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.

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.
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

@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.

@fed-tech
fed-tech merged commit 087591b into fed-tech:main Aug 10, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants