Read-only (viewer) role for project members - #50
Merged
Merged
Conversation
Lets a project owner invite someone by email to view stats (free signup,
no payment) without granting edit access.
DB (migration 20260611120000):
- project_members.role and project_invitations.role ('member' | 'viewer')
- is_project_editor() helper (members minus viewers, plus org owner/member)
- every member WRITE policy (projects update, project_repos insert,
tracker_integrations insert/update/delete, lx_site insert/update) now
requires editor; all SELECT policies unchanged so viewers keep read access
App:
- requireProjectAccess() rejects viewers by default (write gate); read-only
endpoints (live-events, run status/markdown) opt in with allowViewer
- invite/accept carries role; Members UI: role selector on invite, role
badge per member, Make read-only / Make editor toggle, setProjectMemberRole
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
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.
Lets a project owner invite someone by email to view stats (free signup, no payment) without granting edit access.
What it does
Enforcement (DB-level, two layers)
is_project_editor()gates every member write policy (projects update, project_repos insert, tracker_integrations insert/update/delete, lx_site insert/update). All SELECT policies unchanged, so viewers keep full read access.requireProjectAccess()rejects viewers by default (backstop for service-role write paths that bypass RLS). Read-only endpoints (live-events, run status/markdown) opt in withallowViewer.Migration
20260611120000_project_member_viewer_role.sql— already applied to production DB. Addsroletoproject_membersandproject_invitations, plusis_project_editor().🤖 Generated with Claude Code