Global admin can move a media item (or a whole document) to another campus #242
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#242
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?
Product owner, GRI-2051, 2026-11-15 17:50 UTC: "is it possible for a global item to change a media object from campus? That way we can transfer objects between campuses, and if we create a media object we can after that edit it to the correct campus."
Today
Not possible. A media item gets its campus once, at upload (
campus::validate_for_create).crates/server/src/media/mod.rshas no update route for media: only list, upload, URL, delete and file. The only way to "move" an item is to delete it and upload it again, which loses its playlist places.What to build
Server:
PATCH /api/v1/media/{media_id}with{ "campus_id": "<uuid>" | null }(null= all campuses).document_id(one per page). Changing the campus of one page changes it for every row of that document, in one transaction. A page of a document never ends up in a different campus from the rest.check_items_campus, #159): campus media may only be in a playlist of the same campus. So before the move, the server reads the playlists that use the item:null) never breaks a playlist. Always allowed.media_in_use_by_other_campus, naming those playlists, the same shape as themedia_in_useerror of delete (GRI-1962). Nothing is changed."remove_from_playlists": true: removes the item from those playlists and moves it, in one transaction. The panel uses this after the user confirms.Panel: on a media item (library), a Campus selector, visible only to a global admin. It lists every campus plus All campuses. On a 409, the panel shows the playlists that would lose the item and asks "Remove it from these N playlists and move it?". For a document the panel says that all its pages move.
Done when
remove_from_playlists, the item leaves those playlists and moves, all or nothing (test).Frontend engineer here. Two things stand in the way of starting, both module-boundary / process questions rather than spec gaps — the spec above is already a complete contract.
1. This issue bundles a backend feature with the panel change. The "Server" section is a new
PATCH /api/v1/media/{media_id}route with real domain logic: a cross-campus authorization check, a single-transaction move of every page of a document, and a read of playlist membership to produce themedia_in_use_by_other_campus409. That is backend-engineer territory (crates/server/src/media), not something I own as the frontend engineer — I have never touchedcrates/on this project, and the two backend engineers (aetherforge, nyssa) have done exactly this shape of work before (GRI-1977, the campus/media permission layer this builds on).2. No tests exist yet for this issue. There is no acceptance-test or unit-test issue filed against #242 (checked via
pc board --search), unlike its sibling features (#172 → GRI-1977/GRI-1980, #213 → GRI-2080). My working rule is not to implement from a spec alone when the tests that should pin the behaviour (the document-atomicity case, the 409-with-playlist-names case, theremove_from_playlistsall-or-nothing case) don't exist yet.Proposal: split this into the backend PATCH endpoint (assigned to a backend engineer) and the panel Campus selector (me), with the panel work landing once the endpoint is real and either engineer or the test writer pins down the three behaviours above in tests first. I can scaffold the panel UI against the already-fully-specified contract in parallel if that's preferred, but I'd rather get your call on the split than guess at a module boundary.
Marking the board issue blocked on you for this call.
Split, per my comment above — the CTO is paused for digital-signage product-breakdown calls right now (GRI-72/GRI-1099), so I'm using the normal Area-label routing instead of waiting on a call nobody can currently make:
PATCH /api/v1/media/{media_id}(campus auth check, document-wide transactional move, playlist 409,remove_from_playlists). Area/Backend, routes to a backend engineer.This issue (#242) stays open for the panel half only: the Campus selector on a media item, global-admin-only, 409 confirmation flow, document-wide move messaging. I'm blocked on #244 landing (need the real route to build against) and on #245 existing (my working rule is not to implement from a spec alone). Will pick the panel back up once both are there.
Done. Backend PATCH /api/v1/media/{media_id} (#244/GRI-2116, via #253) and the panel Campus selector (#254/GRI-2111) are both merged into dev, with their own acceptance tests (#245/#247, GRI-2115) also merged. All
Done whenboxes covered: global admin can move an image/URL/video/document (all pages move together, same transaction); campus admin gets 403 and no selector; a move that would break another campus's playlist is refused naming the playlists (409 media_in_use_by_other_campus); remove_from_playlists removes-and-moves atomically; existing playlist-change push covers device updates. Closing.