GRI-2212: restrict clearing a device's campus to global admins only #329

Merged
vivy merged 1 commit from fix/GRI-2212-clear-campus-scoped-admin into dev 2026-11-18 13:59:17 +00:00
Member

Summary

Follow-up to #328: the panel's canClearCampus check was user.isAdmin
alone, so a campus-bound admin (isAdmin true, campusId set) still saw and
could pick All campuses on a device — and then hit the server's 403,
since the server only allows a user who may access every campus (campus_id
null) to clear it.

  • DevicesScreen.tsx: canClearCampus is now user.isAdmin && user.campusId === null.
  • DevicesScreen.test.tsx: added a scopedAdmin fixture (isAdmin: true,
    campusId set) and a test asserting it does not see the All campuses
    option, alongside the existing campus-admin (isAdmin: false) case.

Test plan

  • npx vitest run src/screens/DevicesScreen.test.tsx — 31/31 passed
  • npx tsc --noEmit — clean
  • npm run lint — clean
## Summary Follow-up to #328: the panel's `canClearCampus` check was `user.isAdmin` alone, so a campus-bound admin (isAdmin true, campusId set) still saw and could pick **All campuses** on a device — and then hit the server's 403, since the server only allows a user who may access every campus (campus_id null) to clear it. - `DevicesScreen.tsx`: `canClearCampus` is now `user.isAdmin && user.campusId === null`. - `DevicesScreen.test.tsx`: added a `scopedAdmin` fixture (isAdmin: true, campusId set) and a test asserting it does not see the All campuses option, alongside the existing campus-admin (isAdmin: false) case. ## Test plan - [x] `npx vitest run src/screens/DevicesScreen.test.tsx` — 31/31 passed - [x] `npx tsc --noEmit` — clean - [x] `npm run lint` — clean
GRI-2212: restrict clearing a device's campus to global admins only
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 15s
CI / cargo deny (pull_request) Successful in 21s
CI / cargo deny advisories (pull_request) Successful in 21s
CI / cargo clippy (pull_request) Successful in 1m30s
CI / repository boundary (pull_request) Successful in 4s
CI / frontend-web (pull_request) Successful in 1m11s
CI / cargo test (pull_request) Successful in 4m20s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
e0755b9ac5
A campus-bound admin (isAdmin true, campusId set) could still see and
choose All campuses in the panel; the server already refuses that with
403, so align the client check with it.
vivy merged commit bf59402017 into dev 2026-11-18 13:59:17 +00:00
vivy deleted branch fix/GRI-2212-clear-campus-scoped-admin 2026-11-18 13:59:17 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!329
No description provided.