Skip to content

Access allow-list: only approved people use JDWriter; others request access in the app - #84

Merged
NDL3wis merged 1 commit into
mainfrom
feat/access-allow-list
Nov 3, 2026
Merged

NDL3wis merged 1 commit into
mainfrom
feat/access-allow-list

Conversation

@NDL3wis

@NDL3wis NDL3wis commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Why

CRU asked for access to JDWriter to be gated by an approved list kept in the app, not in Azure. People not on the list should be told to request access and be able to do it right there. Requests reuse the reports inbox from #83.

What changed

  • Who gets Author:
    • only approved campus logins (AccessGrants, migration AccessGrants) and admins;
    • anyone else who signs in gets no role, and every endpoint refuses them, since all controllers already require Author or Admin;
    • it's read on every request, so approving or removing someone takes effect on their next page.
  • Guard test: Every_endpoint_but_the_users_own_account_and_sign_in_requires_a_role fails if a controller ever asks only for a signed-in user.
  • /request-access: what someone without access sees, with none of the app around it.
    • Who they're signed in as, an optional note, and Request access.
    • Once asked: when they asked, Check again (a refetch, no polling), and a way to add to the request. Asking again updates the open request.
  • Reports inbox: requests arrive as Access request cards, with Approve access (adds the login and resolves the request) or Decline.
  • Settings → Who can use JDWriter:
    • give access by login ID;
    • the approved list, with Remove;
    • "Signed in without access", with those who asked first, each with Approve, plus Approve all N for the switch-over.
  • Endpoints:
    • /api/user/me gains accessRequestedAt;
    • POST api/user/access-request, for anyone signed in;
    • GET/POST api/admin/access, DELETE api/admin/access/{login}, POST api/admin/access/approve-waiting and POST api/admin/reports/{id}/approve-access, for admins.
  • AGENTS.md: records the decision and the role rule.

Validation

  • Server: dotnet test --filter "Category!=CorpusParity&Category!=LiveApi" passes 823 tests.

    • New tests cover: access is admins plus approved logins (normalized, non-campus refused); a request is filed once and updated, /me reports it, and approving resolves it; someone with access isn't filed; approval from the inbox; and the endpoint guard.
    • Role tests were updated: an unlisted campus account now gets no role.
  • Client: lint and tsc -b are clean. Vitest passes 216 tests. New tests cover:

    • someone without access is redirected to the request page, asks, and gets in after approval;
    • the Settings panel's approve, approve all, add and remove;
    • approving from the inbox.
  • Local, Chrome:

    • the "basic" persona lands on /request-access, and its direct /api/classes call returns 403;
    • after it asks, the admin persona approves it from Reports and it shows in Settings;
    • after Check again, "basic" is in the app, /api/classes returns 200, and it doesn't get Back end.

    The test data was removed.

Deployment notes

  • Merging deploys to prod, and the migration only adds a table. From then on only admins can use the app until people are approved. Settings → Who can use JDWriter → Approve all N restores everyone who has already signed in, in one click.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 773754c0-f530-4860-9b11-09fe9b93c189
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

…ccess in the app

CRU asked for app use to be gated by an approved list kept in the app,
not in Azure.

- Roles: Author now goes only to approved campus logins (new
  AccessGrants table, migration AccessGrants) and to admins. Anyone
  else who signs in gets no role. Every controller already requires
  Author or Admin, so every endpoint refuses them. A test now
  guards that no endpoint, apart from the user's own account and
  sign-in, asks only for a signed-in user. It's read on every
  request, so approving or removing someone takes effect on their
  next page.
- Without access, you land on /request-access, with none of the app:
  who you're signed in as, an optional note ("who you are and what
  you'll use it for"), and Request access. Once asked, it says when,
  offers Check again (a plain refetch, no polling) and lets you add to
  the request. Asking again updates the open request.
- Requests reuse the reports system. Each is a ProblemReport of kind
  Access in Back end → Reports, with Approve access (adds the sender's
  login and resolves it) or Decline.
- Back end → Settings → "Who can use JDWriter":
  - give access by login ID;
  - the approved list, with Remove;
  - "Signed in without access", those who asked first, each with
    Approve, plus "Approve all N" for the switch-over.
- /api/user/me says when someone without access asked. New endpoints:
  - POST api/user/access-request, for anyone signed in;
  - GET/POST api/admin/access, DELETE api/admin/access/{login},
    POST api/admin/access/approve-waiting and
    POST api/admin/reports/{id}/approve-access, for admins.
- AGENTS.md records the decision and the role rule.

When this deploys, everyone but the admins needs approving. The
"Approve all" button on Settings does it in one go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NDL3wis
NDL3wis force-pushed the feat/access-allow-list branch from 4635a3c to e811328 Compare November 3, 2026 18:58
@NDL3wis
NDL3wis merged commit 199db63 into main Nov 3, 2026
4 checks passed
@NDL3wis
NDL3wis deleted the feat/access-allow-list branch November 3, 2026 19:01
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.

1 participant