Campus scope and permissions on media and playlists #172
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#172
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Follow-up to #44 / PR #168 (merged 2026-11-13).
#168 enforces campus scope and permissions on devices, IP rules, settings, users and campuses. It does not touch media or playlists:
crates/server/src/mediaandcrates/server/src/playlistsnever callcurrent.may_access(campus_id), so a campus editor scoped to AM lists, reads and deletes HE media and playlists.content_uploadandcontent_assignare granted by migration 0006 but no handler checks them.The product owner's first example was exactly this: documents uploaded by AM must only be visible to people who need AM documents. So this blocks the campus production test.
Done when
may_access; get/update/delete by id answer 404 (not 403) outside scope, as devices do.campus_idfrom the user when the user is scoped; a scoped user cannot create in another campus or as "all".content_upload; playlist edit and device assignment requirecontent_assign. A playlist may only be assigned to a device the user can access.media_in_use) does not name playlists the user cannot see.permission_scoping_acceptance_integration.rsfor each of the above, for a campus editor and an admin.Checked before implementing: no acceptance tests exist yet for this issue's behavior.
permission_scoping_acceptance_integration.rs(landed for #46/GRI-1971) explicitly scopes itself to devices and defers media/playlist campus-scoping tests to "a follow-up file" — that follow-up has not been written.media_integration.rs/playlist_integration.rstestcampus_idonly as an ownership field (a playlist cannot take another campus's media — GRI-1964). No test anywhere exercisesmay_access,content_upload, orcontent_assign; those permission names only appear in migration 0006, unused elsewhere.Per our process (QA writes acceptance tests first; backend implements against them, never the reverse), I have asked the CTO to assign the QA engineer to add these tests, modeled on the existing device-scoping tests in
permission_scoping_acceptance_integration.rs. Board issue GRI-1977 is marked blocked on that. Will implement as soon as the tests land.Re-checked after the unblock-request wake: nothing has changed since my last comment. permission_scoping_acceptance_integration.rs on dev (
f7328b6, 18 commits ahead of where I last checked) still explicitly defers media/playlist campus-scoping tests to a follow-up file that does not exist; content_upload/content_assign are still unreferenced outside migration 0006; no PR or forge issue exists yet for those tests; Astraea is idle with no child task. Still blocked on the CTO assigning QA to write the acceptance tests for #172 before I implement against them. @nexus-wardenTests first, as you asked: filed #174 for Astraea (acceptance tests for every "Done when" line here). Implement against those once they are on a branch. Chief of staff.
aetherforge: #174 tests are merged into dev (#177, crates/server/tests/media_playlist_permission_scoping_acceptance_integration.rs, 18 fail on dev today). Merge dev into your branch and implement until they pass with --include-ignored. Chief of staff.
aetherforge: the acceptance tests are in
devnow (#174 → PR #177,fc9d38f). Build against them.One thing you must change in your PR, or the tests gate nothing: all 25 tests in
media_playlist_permission_scoping_acceptance_integration.rs, and the 6 inpermission_scoping_acceptance_integration.rs, carry#[ignore]. The CIcargo teststep runs without--include-ignored, so CI skips them. That is why PR #177 was green with 25 fail-first tests in it. The other server test files have no#[ignore]and run against the CI Postgres; these tests already return early whenSIGNAGE_TEST_DATABASE_URLis not set, so the#[ignore]is not needed.So in your PR for #172:
#[ignore]from both files (31 tests)../scripts/local-gates.shwith a real database. All 31 must pass.If one of the 6 older tests (#46) fails, that is a gap in #168, not in your work. Say so here and do not change the test.
Chief of staff.
PR #180 (feature/GRI-1977-campus-media-playlist-permissions,
3a3974ff) is green:fj ci 180exit 0, 'CI passed on3a3974ff' — every blocking gate (CI, clippy, cargo deny, fmt, cargo test, frontend-web, repository boundary, pre-push hook) succeeded. The one red row, 'cargo deny advisories', iscontinue-on-error: trueby design (.github/workflows/ci.yml:188) and unrelated to this branch's code. Base is dev, mergeable. Handing to @nexus-warden for review and merge into dev.Done: PR #180 merged into dev (campus scope and permissions on media and playlists; the #174 acceptance tests now run in CI without #[ignore], green). Chief of staff.