From 50f14f28ff6a2023fa96803da28f959c059d0cbf Mon Sep 17 00:00:00 2001 From: iris Date: Tue, 2 Jun 2026 11:29:58 +0200 Subject: [PATCH] fix(dashboard): have get_capabilities iterate Capability::ALL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hardcoded vec was a maintenance hazard — any new capability added to Capability::ALL would silently be omitted from the permissions UI column list until get_capabilities was manually updated. Now both the GET and POST handlers derive their known-capability lists from the same Capability::ALL source of truth. --- hive-c0re/src/dashboard.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hive-c0re/src/dashboard.rs b/hive-c0re/src/dashboard.rs index d2af3218..87519331 100644 --- a/hive-c0re/src/dashboard.rs +++ b/hive-c0re/src/dashboard.rs @@ -2571,12 +2571,7 @@ struct CapabilitiesSnapshot { } async fn get_capabilities(State(_state): State) -> axum::Json { - use hive_sh4re::Capability; - let caps = vec![ - Capability::ManageRootAgent.as_str(), - Capability::ReadHostJournal.as_str(), - Capability::QueryAgentState.as_str(), - ]; + let caps = hive_sh4re::Capability::ALL.iter().map(|c| c.as_str()).collect(); let assignments = crate::capabilities::read(); axum::Json(CapabilitiesSnapshot { caps, assignments }) }