feat(api-keys): can_manage_maintenance scope for HA-style automations (#1832 follow-up)

Carve MAINTENANCE_CREATE/UPDATE/DELETE out of the admin denylist so
HA automations can log "cleaned nozzle" / reset a counter via API key
without granting broader printer control. Follows the same shape as
can_manage_library and can_manage_inventory: new column, allowlist
entry, UI checkbox, wiki row, RBAC test coverage.

Distinct backfill: these perms were EXPLICITLY denied for every API
key before this change (no existing integration relies on them), so
existing rows migrate to FALSE — no silent scope widening on upgrade.
New keys default to TRUE, matching the safe-on-by-default pattern.
Bundled SpoolBuddy kiosk key gets False explicitly (kiosk doesn't need it).
This commit is contained in:
maziggy
2026-07-01 09:21:09 +02:00
parent b71d486058
commit 006c3113a0
23 changed files with 146 additions and 27 deletions
+3
View File
@@ -1048,6 +1048,7 @@ export interface APIKey {
can_read_status: boolean;
can_manage_library: boolean;
can_manage_inventory: boolean;
can_manage_maintenance: boolean;
can_access_cloud: boolean;
can_update_energy_cost: boolean;
printer_ids: number[] | null;
@@ -1064,6 +1065,7 @@ export interface APIKeyCreate {
can_read_status?: boolean;
can_manage_library?: boolean;
can_manage_inventory?: boolean;
can_manage_maintenance?: boolean;
can_access_cloud?: boolean;
can_update_energy_cost?: boolean;
printer_ids?: number[] | null;
@@ -1081,6 +1083,7 @@ export interface APIKeyUpdate {
can_read_status?: boolean;
can_manage_library?: boolean;
can_manage_inventory?: boolean;
can_manage_maintenance?: boolean;
can_access_cloud?: boolean;
can_update_energy_cost?: boolean;
printer_ids?: number[] | null;