You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c03a2d5
Browse filesBrowse the repository at this point in the historyBrowse files
docs(permissions): name declared membershipKeys in the RLS guide's context variables
Add the current_user.KEY row to the Context variables table, linked to the
reference page's "Where a membership key comes from", and rewrite the closing
paragraph to name both sources: a membershipKeys declaration on the roster
object first, with one checked example, and a registered membership resolver
as the deployment-side extension.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbaFpnMwgpCgneKe2qS
Copy file name to clipboardExpand all lines: content/docs/permissions/rls.mdx
+44-3Lines changed: 44 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,16 +165,57 @@ not this one):
165
165
|`current_user.positions`| The user's positions (array) |
166
166
|`current_user.org_user_ids`| User ids in the user's org (array) |
167
167
|`current_user.email`| The user's email |
168
+
|`current_user.KEY`| A set a roster object declares under [`membershipKeys`](/docs/references/security/rls#where-a-membership-key-comes-from) (array, read with `in`) |
168
169
169
170
<Callouttype="info">
170
171
**`current_user.name` is deliberately not exposed.** Names aren't unique — a
171
172
policy keyed on a display name would hand a second "John Smith" someone else's
172
173
rows. Match on `id` or `email`, which are.
173
174
</Callout>
174
175
175
-
Deployments can inject additional membership sets (team ids, territory codes)
176
-
into the evaluation context, which lets policies express set membership without
177
-
subqueries the grammar doesn't allow.
176
+
Any other `current_user.KEY` is a **membership set**: a pre-resolved array that
177
+
lets a policy express set membership without the subqueries the grammar doesn't
178
+
allow. Declare it first — a `membershipKeys` entry on the **roster** object whose
179
+
rows define the set names the user column (`userField`), the reference column
180
+
whose values form the set (`valueField`) and an optional `filter` over the
181
+
roster's own columns, and every policy reads the result as `current_user.KEY`:
0 commit comments