GRI-2212: allow setting a device back to All campuses #328
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!328
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/GRI-2212-device-clear-campus"
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?
Summary
Forge #323: a device that already has a campus could not be set back to All campuses — the server treated an absent
campus_idandnullas the same thing ("leave it unchanged"), and the panel's campus select disabled the empty option.UpdateDeviceRequest.campus_idis now three-state (absent = unchanged,null= clear, uuid = that campus), viaOption<Option<Uuid>>. Clearing is refused with 403 unless the caller may access every campus (global admin). Clearing never runs the playlist-mismatch check (#310) — a device with no campus fits any playlist.campus_id: null.plan/server/rest-api.mdupdated for thePATCH /devices/{id}contract.Test plan
cargo test -p server --test devices_integration -- --include-ignored— 29/29 passed, including the new cases: absent field leaves campus unchanged, global admin clears to null, a device on a campus playlist can still be cleared, a campus editor gets 403 clearing.cargo fmt --check,cargo clippy -p server --testsclean.npx tsc --noEmit,npm run lintclean.npx vitest run src/screens/DevicesScreen.test.tsx— 30/30 passed, including: global admin sees All campuses and choosing it calls the API withnull; a campus admin does not see it.campus_id becomes three-state (absent/null/uuid) on PATCH /devices/{id}. Clearing requires global-admin access and skips the playlist-mismatch check, since a device with no campus fits any playlist. Panel offers an All campuses option to global admins only.