Skip to content

feat(cli): campus grant commands + grant-model docs alignment (#50) - #51

Merged
ngjunsiang merged 1 commit into
mainfrom
feat/50-grant-commands
Oct 10, 2026
Merged

ngjunsiang merged 1 commit into
mainfrom
feat/50-grant-commands

Conversation

@ngjunsiang

Copy link
Copy Markdown
Contributor

Addresses #50 for the campus#883 grant-store model (three parts, one PR):

1. campus grant command group

list (filters: --grantee-type/--grantee-id/--resource-type/--resource-id), check, grant, revoke (destructive-confirmed), delete — all with --dry-run/--json, backed by campus.auth.grants (requires campus-api-python#107; lockfile relock PR follows merges). Client-side validation mirrors the server: exactly one of --level/--bits, vault rows must name a label.

2. campus auth status grant rows

When online and authenticated, status fetches the caller's rows (GET /grants/ filtered by grantee) and renders Grant rows: users:write, clients:write — degrading to a dim note for the 403 case (rows are visible to the operator, the root, and grants admins only). --offline notes "not fetched". JSON adds grants/grants_note.

3. Docs alignment

README "Token scopes" section and campus user/campus client command help now state the actual model: grant row AND scope (either leg alone confers nothing), the root carve-out, the clients-write cap, and point at campus grant list — replacing the retired AUTH_ADMIN_USER_IDS/AUTH_USERS_ADMIN_USER_IDS narrative.

Known issue

Unfiltered campus grant list 500s for the super-admin root (server-side: list_grants asserts resource_type is not None after a gate #900 taught the root to pass) — bug being filed on campus; use --resource-type until fixed.

Tests: +14 (grants formatting/validation, status grant rows incl. offline/degradation), suite 211 passed, ruff clean. Smoke: campus grant list --resource-type users live as root returned the matrix; campus grant --help renders.

Closes #50.

The authorization model moved under campus#883: management authority
is a DB-backed grant row (administered via /auth/v1/grants/) AND the
token scope, with an env-nominated super-admin root as the sole A8
exception. The env-var designations the CLI docs still teach are
retired.

- new `campus grant` group: list (the who-can-administer-what
  matrix), check, grant, revoke (confirmed), delete — backed by
  campus.auth.grants (requires campus-api-python#107; relock follows)
- `campus auth status` shows the caller's grant rows when readable,
  degrading to an explanatory note otherwise (operators, the root
  and grants admins only), with --offline skipping the fetch
- user/client command help and the README Token scopes section now
  state the row-AND-scope model, the root carve-out, and the
  clients-write cap instead of the retired env-var designations

Note: unfiltered `campus grant list` currently 500s for the root
(server-side assert-as-flow-control, campus#906); use
--resource-type until that fix lands.
@ngjunsiang
ngjunsiang force-pushed the feat/50-grant-commands branch from 9087968 to 8173cce Compare October 10, 2026 15:41
@ngjunsiang
ngjunsiang merged commit a0332b1 into main Oct 10, 2026
4 checks passed
@ngjunsiang
ngjunsiang deleted the feat/50-grant-commands branch October 20, 2026 13:14
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.

docs(cli): align Token scopes section and command help with the #883 grant-store model

1 participant