GRI-1964: campus as owner of media, playlists, devices and IP rules #162
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!162
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-1964-campus-ownership"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Campus as owner of media, playlists, devices and IP rules — forge issue #159
(GRI-1964). Per the product owner's decision on GRI-1960:
campustable, four rows in the migration.
campus_idonmedia,playlists,devicesandip_rulesis nullable,NULLmeans"every campus". No join table, no multi-campus.
NULL, so nothing disappears on upgrade.every campus — and the reverse holds too: a shared playlist cannot take
one campus's exclusive media, or that campus's content would show up for
every other one.
rule's campus; an admin can assign one by hand through
PATCH /devices/{id}.GET /api/v1/campuseslists the seeded campuses.Device groups are not touched: no
device_groupstable exists yet (Phase2, per the comment on
ip_rules.target_group), so there is nothing to adda column to. It picks up
campus_idwhen that table is created.Known gap, left for #44
The issue's "Done when" also asks that every endpoint filter by the
caller's campuses, and that a direct id of another campus answer 404, not
403. Neither is built here: there is no user-campus scope yet — Phase 4
permissions, including user groups, do not exist (
auth/mod.rs:"Permissions and groups are Phase 4 ... for the MVP, being signed in is the
only thing
CurrentUserproves"). The product owner's own comment on #159sequences #44 after this issue and describes a user's scope as "the same
shape" as an object's — one campus, or all — which this change's data model
is what #44 will need. Flagging this explicitly rather than silently
narrowing the acceptance criteria.
Test plan
cargo test --workspace --all-targets --locked(gated integrationtests run against a real Postgres via
SIGNAGE_TEST_DATABASE_URL)cargo clippy --workspace --all-targets --locked -- -D warningscargo fmt --all --checkcampus_idround-trips, unknown-campus-id rejection, and the four-wayplaylist/media compatibility matrix (own campus, shared media, shared
playlist + campus media, cross-campus media).
Change request from the product owner (GRI-1969) — PR #162 is not ready to merge.
His words: "AM, HE, JO, NO … are the real campus names of the school where I work for. Let the user choose what campus names they want, without forcing them to delete campuses they do not need. That is in my eyes bloat. But you can use those for your tests."
So:
0005_campus.sql: create thecampustable empty. Remove theINSERTof AM/HE/JO/NO and the comment lines that call them the campuses. A fresh install has zero campuses. With zero campuses every object stayscampus_id = NULL(all campuses), which is correct for a single-site school.POST /api/v1/campuses{code, name}→ 201; duplicatecode→ 409.PATCH /api/v1/campuses/{id}{code?, name?}→ rename.DELETE /api/v1/campuses/{id}→ 204 when nothing references it; 409 when a media item, playlist, device or IP rule still points at it. Do notON DELETE SET NULL: that silently turns one campus's content into content for every campus.The migration comment already promised "the panel can add, rename or remove a row" — this makes it true.
POST, or an insert in the test helper). Replacethe_seeded_campuses_are_listed_by_codewith: a fresh database lists no campuses; create → list → rename → delete round-trip; duplicate code → 409; delete of a referenced campus → 409.campus.rsdoc: drop "seeded"; say campuses are created by the operator.Front end (panel page for campuses) is not in this PR; say so in the description as a follow-up.