api: read-only users directory facade — /api/v1/users with circles authz (staff full list, circle-scoped student search)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- mongodb, postgresql, python
- Domain
- api, authorization, backend
Research direction
Start with the authz gate's FAMILY_OPERATIONS mapping and the circles model described in docs/circles-access-control.md, then trace how campus.api forwards requests to campus.auth. Done means the users family passes read-only gate tests for staff, students and client principals, and the facade routes rewrite and forward queries as the issue specifies. The open decision on an empty student visible set (empty result versus 403) must be settled before the work can be finished.
Written by the indexing model from the issue text.
Description
Problem
campus.auth is walled by design: mutation work there (user creation/import, session/login inspection, vault management) is admin-only, and on a daily basis routine mediation runs through the operator. Viewing the directory is the one anomaly: staff need to see and search the user list for everyday jobs (roster checks, subjcombi fixes, lookups), but the only existing path is the shared operator credential — which destroys attribution, the whole point of #854 ("domain administration must be attributable to a user").
Ratified 2026-11-24 (JS Ng): a read-only directory facade on campus.api — campus.api authorizes, rewrites the query, and forwards to campus.auth. Service boundaries are maintained: campus.api and campus.auth run separate Mongo/Postgres (Railway topology), so there are no in-process reads; forwarding is the only path.
Slice 1 — the users family in the authz gate
FAMILY_OPERATIONS["users"] = {"group": {"read"}, "self": {"read"}}— deliberately the only family with no write semantics; the surface cannot mutate by construction. Identity administration stays in campus.auth, admin-only, untouched.- Bootstrap the
usersgrant circle and wire it into the root family set (same as the other resource circles). - Staff pass group-read via the
staff:viewerbaseline → full list. - Students get no users baseline — their visibility comes from the circle-scope computation below. Their
studentprimary-group membership sits at guest, which carries no group-read, so the platform roster never leaks through the baseline. - Field masks: group read = directory fields (id / email / name / activated_at — the whole
Userrecord today); self read = the caller's own record. require_user_principalon every route (#854); client principals denied on the facade.- Spec update (
docs/circles-access-control.md) + gate tests.
Slice 2 — facade routes: authz → query rewrite → forward
GET /api/v1/users— paginated (prod has ~1,562 users),?limit/?cursor,?q=substring search over name/email.GET /api/v1/users/<user_id>— single record; any authenticated user may fetch their own record (self read).- Scope computation, then the query rewrite, then the forward:
- Staff caller (users family group-read via baseline): forward the paged/search query as-is.
- Student caller: visible set = union of member ids across circles where the caller's own membership value carries group-read (viewer). Forward an id-set-filtered query with the search term applied within the set. Design notes: a circle membership at guest confers nothing; viewer/editor/admin on the circle confers directory read of its members — so "student leader of a club" needs no extra role logic. Empty visible set → empty result or 403 (decide at PR).
- Neither → 403.
- Forwarding: service-to-service call to campus.auth's existing user-query surface using a dedicated campus.api service OAuth client holding
users:readin the grant store (minted by the operator). This is the grant store's only participation: it gates the service client at auth's management boundary, while campus.api's own authz never consults the grant store (boundary intact, per the authz module note). Precedent for service clients holdingusers:read: #1189 (flask_campus identity re-fetch). - End-user attribution lives on the facade: every call carries a user principal and lands in campus.audit under that user, not the service client.
- OpenAPI regen (all services, sort_keys ritual).
Out of scope
- Seeding class/CCA member-list circles — a separate data slice; the student scope works the moment such circles exist with member access at viewer, and students see an empty search until then (today's behavior anyway).
- Any mutation surface; any campus-model change (none needed:
Usercarries the directory fields, groupings ride the existing circles mechanism, search/pagination are API parameters).
Dependency for: ttv2#174 (import-time teacher-name resolution), ttv2#175 (browse pickers). Follow-up: SDK + CLI surface (separate issue).
- Dominant language
- Python
- Stars
- 0
- Forks
- 2
- Avg merge
- 39m
- Merged PRs (30d)
- 235
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nyjc-computing/campus
-
enhancement for-collaborators for-contributors
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nyjc-computing/campus#451 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
nyjc-computing/campus#1320 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 25/100
nyjc-computing/campus#1309 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
nyjc-computing/campus#1300 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 5/100
nyjc-computing/campus#1295 · 4 comments ·
Maintainers usually reply within 1 day
All issues in nyjc-computing/campus
Similar issues
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
kornia/kornia-rs#1416 · 1 comment ·
Maintainers usually reply within 2 days
-
ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/ai-inequality#64 ·
Maintainers usually reply within 1 day
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timePossibly taken @PabloRoque claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc-extras#839 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day