Multi-tenant: albums owned per photographer
ci / docker (push) Successful in 9s

- albums.owner_id (migration 0003, backfilled to the original user)
- owned::{album,photo,share} are the only admin data-access paths; another
  tenant's resources are indistinguishable from nonexistent (404)
- every admin handler threaded through ownership; each ALLOWED_EMAILS entry
  is now its own isolated workspace
- tenant-isolation integration test matrix (tests/tenancy.rs, env-gated on
  TEST_DATABASE_URL) driving the real router
This commit is contained in:
2026-07-17 14:52:23 +02:00
parent 8baed71701
commit 9da159aa0f
12 changed files with 357 additions and 36 deletions
+10
View File
@@ -0,0 +1,10 @@
-- Albums gain an owner: the tenancy root. Photos, shares, ratings and tags
-- all hang off albums, so this single column scopes everything.
alter table albums add column owner_id uuid references users(id);
-- Existing albums belong to the instance's original photographer.
update albums set owner_id = (select id from users order by created_at limit 1);
alter table albums alter column owner_id set not null;
create index albums_owner_idx on albums (owner_id);