canvas-website/worker
Jeff Emmett c00106e2b7 feat: implement user permissions system (view/edit/admin)
Phase 1 of user permissions feature:
- Add board permissions schema to D1 database
  - boards table with owner, default_permission, is_public
  - board_permissions table for per-user permissions
- Add permission types (PermissionLevel) to worker and client
- Implement permission API handlers in worker/boardPermissions.ts
  - GET /boards/:boardId/permission - check user's permission
  - GET /boards/:boardId/permissions - list all (admin only)
  - POST /boards/:boardId/permissions - grant permission (admin)
  - DELETE /boards/:boardId/permissions/:userId - revoke (admin)
  - PATCH /boards/:boardId - update board settings (admin)
- Update AuthContext with permission fetching and caching
  - fetchBoardPermission() - fetch and cache permission for a board
  - canEdit() - check if user can edit current board
  - isAdmin() - check if user is admin for current board
- Create AnonymousViewerBanner component with CryptID signup prompt
- Add CSS styles for anonymous viewer banner
- Fix automerge sync manager to flush saves on peer disconnect

Permission levels:
- view: Read-only, cannot create/edit/delete shapes
- edit: Can modify board contents
- admin: Full access + permission management

Next steps:
- Integrate with Board component for read-only mode
- Wire up permission checking in Automerge sync
- Add permission management UI for admins

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-05 22:27:12 -08:00
..
shapes pin object, fix fathom, and a bunch of other things 2025-11-11 22:32:36 -08:00
AutomergeDurableObject.ts feat: implement user permissions system (view/edit/admin) 2025-12-05 22:27:12 -08:00
assetUploads.ts fix asset upload rendering errors 2025-03-19 18:30:15 -07:00
automerge-init.ts feat: implement binary Automerge CRDT sync and open-mapping module 2025-12-04 19:45:02 -08:00
automerge-r2-storage.ts feat: implement binary Automerge CRDT sync and open-mapping module 2025-12-04 19:45:02 -08:00
automerge-sync-manager.ts feat: implement user permissions system (view/edit/admin) 2025-12-05 22:27:12 -08:00
boardPermissions.ts feat: implement user permissions system (view/edit/admin) 2025-12-05 22:27:12 -08:00
cryptidAuth.ts Add backlog tasks from worktrees and feature branches 2025-12-03 21:56:54 -08:00
schema.sql feat: implement user permissions system (view/edit/admin) 2025-12-05 22:27:12 -08:00
types.ts feat: implement user permissions system (view/edit/admin) 2025-12-05 22:27:12 -08:00
wasm.d.ts feat: implement binary Automerge CRDT sync and open-mapping module 2025-12-04 19:45:02 -08:00
worker.ts fix: implement real-time Automerge sync across clients 2025-11-16 19:45:36 -07:00