Repository navigation
Use one rule for who can see the whole organization - #37
Merged
Merged
Conversation
Roles, assignments and processes are readable by members, or by anyone if the org is public. Several pages instead required logged-out viewers for public orgs and members otherwise, so logged-in non-members of a public org were told it was private. Define the rule once in the org context and use it everywhere. Keep the change status editor for members only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem
RLS lets anyone read a public org's roles, assignments and processes, and lets members read them in any org. #36 hides role charts under that rule. The roles, role, processes and changes pages used a narrower one:
So people who are logged in but not members of a public org were told "You are not a member of this private organization…", "Only showing public processes of this private organization" and so on, even though the data had loaded.
Change
visibleto the org context (member || org.visibility === 'public'), with a comment tying it to the RLS policies.Changes.sveltehad used the same flag to decide whether to show the status editor. That now has its own members-only check, so widening visibility doesn't give outsiders an editor whose saves would fail.OrgNav.svelteis unchanged. It also handles'admin'org visibility and decides which nav links appear, which is a different question.Testing
On the local stack, I visited roles, a role, processes, changes and a process page as each viewer:
mainOnly members see the status editor in every case. No console warnings or hydration errors. The one console error is the expected 404 when an outsider opens a private org's role page.
svelte-check: 0 errors. Unit tests: 288 passed.🤖 Generated with Claude Code