GRI-2212: restrict clearing a device's campus to global admins only #329
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!329
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/GRI-2212-clear-campus-scoped-admin"
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
Follow-up to #328: the panel's
canClearCampuscheck wasuser.isAdminalone, 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:canClearCampusis nowuser.isAdmin && user.campusId === null.DevicesScreen.test.tsx: added ascopedAdminfixture (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 passednpx tsc --noEmit— cleannpm run lint— clean