@@ -127,6 +127,8 @@ export function SystemView() {
127127 const roleLoading = userRole === null ;
128128 // Only admin can restart/shutdown system; default to false while loading
129129 const canControlSystem = ! roleLoading && userRole === 'admin' ;
130+ // Operational health endpoints require the same system-admin permission.
131+ const canViewSystemHealth = canControlSystem ;
130132
131133 // Define all query hooks next
132134 const {
@@ -263,22 +265,24 @@ export function SystemView() {
263265
264266 < div className = "mb-4 border-b border-border" role = "tablist" aria-label = { t ( 'system.sections' ) } >
265267 < div className = "flex gap-2" >
266- < button
267- type = "button"
268- id = "health-tab"
269- role = "tab"
270- data-testid = "health-tab"
271- aria-selected = { activeTab === 'health' }
272- aria-controls = "health-panel"
273- className = { `rounded-t-lg px-4 py-2 text-sm font-medium transition-colors ${
274- activeTab === 'health'
275- ? 'bg-card text-card-foreground border border-border border-b-0 -mb-px'
276- : 'text-muted-foreground hover:text-foreground'
277- } `}
278- onClick = { ( ) => setActiveTab ( 'health' ) }
279- >
280- { t ( 'system.health.tab' ) }
281- </ button >
268+ { canViewSystemHealth && (
269+ < button
270+ type = "button"
271+ id = "health-tab"
272+ role = "tab"
273+ data-testid = "health-tab"
274+ aria-selected = { activeTab === 'health' }
275+ aria-controls = "health-panel"
276+ className = { `rounded-t-lg px-4 py-2 text-sm font-medium transition-colors ${
277+ activeTab === 'health'
278+ ? 'bg-card text-card-foreground border border-border border-b-0 -mb-px'
279+ : 'text-muted-foreground hover:text-foreground'
280+ } `}
281+ onClick = { ( ) => setActiveTab ( 'health' ) }
282+ >
283+ { t ( 'system.health.tab' ) }
284+ </ button >
285+ ) }
282286 < button
283287 type = "button"
284288 id = "system-tab"
@@ -314,7 +318,7 @@ export function SystemView() {
314318 </ div >
315319 </ div >
316320
317- { activeTab === 'health' ? (
321+ { activeTab === 'health' && canViewSystemHealth ? (
318322 < div role = "tabpanel" id = "health-panel" aria-labelledby = "health-tab" >
319323 < SystemHealth />
320324 </ div >
0 commit comments