Files
adminandClaude Opus 5 afca6d13cb Refuse a module to anyone who has no row for it
Until now an account was a key to every module. Being unassigned meant
seeing an empty screen -- nothing had refused you, and "you can see
nothing" is not an access decision.

`dredd.module_permission` is now the one table that says what a person
may do here: no row is no access, `user` may use it, `moderator` may
administer it, and a platform administrator needs no row. It is written
only in the hub; this app holds SELECT on it and nothing else, because a
module that could write it would admit anyone and promote itself.

The check sits in `deps.get_current_user`, right after the token-scope
check and for the same reason the scope check is there: every
authenticated route depends on that function, so one call covers all of
them and no route added later can forget it. Standalone it emits no SQL
and refuses nobody -- core answers `user` for everybody when there is no
platform -- so there is one guard rather than a second code path.

A new revision renames the local `module_moderator` where one exists,
adds the `role` column and backfills every existing row to `moderator`,
because every row that existed was a moderator grant. Editing the cutover
alone would not have reached it: `0001` is stamped and never runs again,
which is the same shape as the `node_kind` failure this family already
learned from. It builds nothing where identity belongs to the hub --
there a local copy would be the shadow table the lifespan assertion
exists to catch.

Requires dredd-core v0.11.0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-01 11:52:05 +02:00
..