Skip to content

Epic: Tiered access — base (auto) + service/upload (admin-gated, export-control) #1013

Open
1 of 5 issues completed

Description

@neuromechanist

Implements the tiered-access model (website ADR 0010): base access auto-granted on ORCID sign-in; service access (upload + compute) gated behind an admin grant that reviews GitHub + location/affiliation for export-control screening. Publishing keeps its own per-dataset approval.

Rationale: ORCID iDs are free to create, so ORCID-verified is not authorization to consume finite compute/storage (abuse-as-free-cloud risk); and NEMAR compute has export-control / local-jurisdiction restrictions requiring a human review of who/where.

Phase 1 — Base auto-approve + close the upload door (NOW)

  • ORCID finalize (auth-orcid.ts) auto-approves to base access (status='approved', not pending) + audit log. Fixes the stuck-pending state (Admin cannot approve ORCID/web signups (username=NULL, stuck at status=pending) #1012).
  • New service-access axis on users (migration): closed by default.
  • Upload endpoint (POST /datasets, non-sandbox) requires service access; base users get a clear "service access required" response. Self-service sandbox no longer suffices.
  • Backfill/grandfather existing uploaders (approved + sandbox_completed, plus owner/admin) so prod users are not locked out.
  • Expose service-access flag + github-present on /auth/me so the frontend can gate the upload UI.
  • Seed test-owner/test-admin/test-user with service access so E2E upload tests keep passing.

Phase 2 — Admin grant flow + export-control review (LATER)

  • Admin endpoint to grant/revoke service access; requires github_username present; records reviewer + timestamp.
  • Admin review surface (in the admin-portal epic, website#158): shows the person's ORCID, GitHub, city/country, affiliation for export-control screening before granting.
  • User-facing "request upload access" flow (website settings/upload).
  • Fix POST /admin/approve/:username to address username=NULL accounts by id and approve from pending (Admin cannot approve ORCID/web signups (username=NULL, stuck at status=pending) #1012) — or fold approval into this grant model.

Phase 3 — Compute/service features (LATER)

  • The compute availability and services the grant unlocks.

Parked

  • Legacy account import (nemar-cli#833 / website#129) — until needed.

Future idea (separate issue)

  • Co-author dataset surfacing: match the signed-in ORCID against dataset authors; let people see/pull datasets they co-authored.

References

Activity

  1. added a commit that references this issue on Jul 24, 2026
  2. neuromechanist commented on Jul 24, 2026

    @neuromechanist
    ContributorAuthor

    Cross-repo homes for the deferred phases: the admin grant/review UI (Phase 2) lives in website admin-portal epic #158. The website upload-page gating + 'request upload access' flow lives in website upload epic #164. This nemar-cli epic owns the backend (grant/revoke endpoint, enforcement — Phase 1 shipped in #1015).

  3. neuromechanist commented on Jul 24, 2026

    @neuromechanist
    ContributorAuthor

    Operational note (from the dev→main promotion review, 2026-07-24): Phase 1 shipped the enforcement + grandfather backfill but NO in-product way to grant service_access. After the prod promotion, new ORCID signups land at base access and the only way to grant upload access is a manual D1 UPDATE until Phase 2:

    wrangler d1 execute nemar-db --remote -c backend/wrangler-sccn.toml \
      --command "UPDATE users SET service_access=1, service_access_granted_at=datetime('now') WHERE id=?"
    

    Owner chose to promote as-is (deferring the grant mechanism to Phase 2). Phase 2's minimal backend slice = an owner/admin endpoint POST /admin/users/:id/service-access (require github_username, record granted_by/at) + a nemar admin CLI command, then the admin-portal review UI (website#158). This should be the first Phase 2 item so prod isn't stuck on raw D1 for long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions