Export: allow viewers to download presets, not just admins (#48) #100
No reviewers
Labels
No labels
area/ai
area/backend
area/frontend
area/infra
area/scheduler
area/wled
good-first-issue
priority/high
priority/low
priority/medium
type/bug
type/chore
type/ci-cd
type/docs
type/feature
type/qa
v1.0.0
v1.1.0
v1.2.0
v2.0.0
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/Iris-WLED!100
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/export-viewer-access"
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?
Closes the last small item on #48.
The spec's rule for the API surface is explicit: "Mutating endpoints require
adminrole… GET endpoints allowviewerunless noted otherwise." Neither export row carries an admin note the way/audit-logdoes, and §10's toolbar list marks "Quick push control (admin only)" while leaving "Export: downloadpresets.json" unmarked. Both export GETs were nonetheless gated onrequire_admin.GET /export/presets.json→require_viewerGET /export/events/{id}.json→require_viewer(same reasoning; leaving it admin-only would have been inconsistent)Un-gating the API alone would not have been enough. The toolbar's Export button lives inside the
{isAdmin && (…)}block, so a viewer had no way to reach the endpoint even once it allowed them. Moved it out — it's now the one always-visible action in that group.Two tests added to the existing viewer/admin matrix in
test_auth.pyso the permission can't regress silently.Verification
ruff check,ruff format --check,mypyclean.node:22container:tsc -b,eslint,vitest(70),npm run buildall clean.🤖 Generated with Claude Code
The spec's rule for the API surface is that "GET endpoints allow `viewer` unless noted otherwise", and neither export row carries an admin note the way `/audit-log` does. Both export GETs were nonetheless gated on require_admin. Un-gating the API alone would not have been enough: the toolbar's Export button sits inside the `{isAdmin && ...}` block, so a viewer had no way to reach the endpoint even once it allowed them. Moved it out. Covered by two tests in the existing viewer/admin matrix so the permission cannot regress silently. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>