feat(demo): make Settings read-only for the demo account - #130
Open
gianniskotsas wants to merge 2 commits into
Open
feat(demo): make Settings read-only for the demo account#130gianniskotsas wants to merge 2 commits into
gianniskotsas wants to merge 2 commits into
Conversation
Demo users can now view every Settings panel (Bank Connections is un-hidden) but cannot mutate anything. Security (server-enforced) — add demo guards to previously-unguarded mutations: updateUserProfile, deleteAllTransactionsAndResetBalances, createCategory, updateCategory, deleteCategoryWithReassignment, deleteApiKey, and the /api/people POST/PATCH/DELETE routes. Adds an isDemoRestrictedSession() helper. UX — disable/hide mutating controls + a "read-only in demo" notice across ProfileEditor (name, photo upload, save), CategoryManager (add/edit/ delete), Household/PeopleList (add/edit/delete), and BankConnectionsManager (connect/sync/recategorize/disconnect). ProfilePhotoUpload gains a disabled prop; the Bank Connections tab is now shown read-only instead of hidden. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…-settings # Conflicts: # frontend/components/settings/bank-connections-manager.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Demo users can now view every Settings panel but cannot change anything. The Bank Connections tab — previously hidden for demo — is now shown read-only, per request ("access every setting as they do now, but prevent them from making changes").
Security (the real lockdown — server-enforced)
Added demo guards (
isDemoRestrictedUserEmail/ newisDemoRestrictedSession()helper →DEMO_RESTRICTED_ACTION_ERROR) to the 9 previously-unguarded mutations:lib/actions/settings.ts:updateUserProfile,deleteAllTransactionsAndResetBalanceslib/actions/categories.ts:createCategory,updateCategory,deleteCategoryWithReassignmentlib/actions/api-keys.ts:deleteApiKeyapp/api/people/route.ts(POST) andapp/api/people/[id]/route.ts(PATCH, DELETE) — return 403 for demoGET/read paths are untouched, so everything stays viewable.UX (disabled controls + "read-only" notice)
DemoReadOnlyNoticebanner shown on each panel for demo.ProfilePhotoUploadgains adisabledprop).CategoryRowgainsreadOnly).settings-tabs.tsx: Bank Connections tab always rendered;isDemoUserthreaded through.Notes
canCreateApiKeys); delete is now server-guarded (button still visible — minor follow-up to hide it).Test plan
pnpm exec tsc --noEmit/pnpm lintin an installed checkout (couldn't run here — worktree has nonode_modules).🤖 Generated with Claude Code
Summary by cubic
Makes all Settings read-only for the demo account and un-hides Bank Connections. Previously demo users had partial client-only guards and the Bank Connections tab was hidden; now they can view every panel while every mutation is disabled in the UI and blocked server-side.
/api/peoplePOST/PATCH/DELETE (403 withDEMO_RESTRICTED_ACTION_ERROR). AddsisDemoRestrictedSession()for consistent checks.DemoReadOnlyNoticeand disables or hides mutating controls across Profile (name, photo upload;ProfilePhotoUploadgainsdisabled), Categories (CategoryRowgainsreadOnly; Add/Edit/Delete hidden), Household (PeopleListgetsreadOnly), and Bank Connections (tab always visible; Connect disabled; Sync/Recategorize/Disconnect hidden).isDemoUserpassed fromSettingsTabsintoProfileEditor,CategoryManager,BankConnectionsManager, andHouseholdTab(which passes toPeopleList).Written for commit 3bdd9ef. Summary will update on new commits.