Skip to content

Use one rule for who can see the whole organization - #37

Merged
amyjko merged 1 commit into
mainfrom
uniform-org-visibility
Nov 7, 2026
Merged

amyjko merged 1 commit into
mainfrom
uniform-org-visibility

Conversation

@amyjko

@amyjko amyjko commented Nov 7, 2026

Copy link
Copy Markdown
Owner

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:

($user === null && org.visibility === 'public') || ($user !== null && member)

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

  • Add visible to the org context (member || org.visibility === 'public'), with a comment tying it to the RLS policies.
  • Use it on the roles, role, processes and changes pages, and in the two places Hide role assignments from viewers who can't see the org's roles #36 added.
  • Changes.svelte had 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.svelte is 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:

Viewer Private org Public org, main Public org, this change
Logged out "private" notices, only public items everything, no notices unchanged
Logged in, not a member "private" notices, only public items "private" notices on every page everything, no notices
Member everything, status editor everything, status editor unchanged

Only 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

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]>
@amyjko
amyjko merged commit eb6eb6a into main Nov 7, 2026
1 check passed
@amyjko
amyjko deleted the uniform-org-visibility branch November 7, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant