fix(auth/ui): sidebar accepts granular *_read tiers for archives/queue/files (#1755)

navPermissions in Layout.tsx gated three resources on the LEGACY *:read flag.
  Default Operators group is seeded with *_own only (and the migration map flips
  legacy → _own on existing groups), so non-admin users never held the legacy
  permission and the sidebar hid Archives / Queue / Files even though the
  underlying API accepted their requests. Reporter only spotted Files; same bug
  shape applied to Archives and Queue.

  Fix: navPermissions accepts Permission | Permission[]; the three affected
  resources list all three tiers. isHidden checks .some(hasPermission) for
  arrays. Permission type extended with the matching *_own / *_all variants —
  backend already shipped them, the TS type just didn't declare them.
This commit is contained in:
maziggy
2026-06-16 07:44:22 +02:00
parent ead6c37147
commit 804fe470fa
6 changed files with 111 additions and 11 deletions
+3 -3
View File
@@ -2898,13 +2898,13 @@ export interface ExternalLinkUpdate {
// Permission type - all available permissions
export type Permission =
| 'printers:read' | 'printers:create' | 'printers:update' | 'printers:delete' | 'printers:control' | 'printers:files' | 'printers:ams_rfid' | 'printers:clear_plate'
| 'archives:read' | 'archives:create'
| 'archives:read' | 'archives:read_own' | 'archives:read_all' | 'archives:create'
| 'archives:update_own' | 'archives:update_all' | 'archives:delete_own' | 'archives:delete_all'
| 'archives:reprint_own' | 'archives:reprint_all' | 'archives:purge'
| 'queue:read' | 'queue:create'
| 'queue:read' | 'queue:read_own' | 'queue:read_all' | 'queue:create'
| 'queue:update_own' | 'queue:update_all' | 'queue:delete_own' | 'queue:delete_all'
| 'queue:reorder'
| 'library:read' | 'library:upload'
| 'library:read' | 'library:read_own' | 'library:read_all' | 'library:upload'
| 'library:update_own' | 'library:update_all' | 'library:delete_own' | 'library:delete_all'
| 'library:purge'
| 'projects:read' | 'projects:create' | 'projects:update' | 'projects:delete'