ConstReturns current authenticated user ID
Maps to auth.uid() in PostgreSQL (commonly used with Supabase).
This returns the user ID from the JWT token.
A ContextValue representing the current user's ID
// Basic user ownership
column('user_id').eq(auth.uid())
// In a policy
policy('user_documents')
.on('documents')
.read()
.when(column('user_id').eq(auth.uid()));
// With complex conditions
policy('project_access')
.on('projects')
.read()
.when(
column('created_by').eq(auth.uid())
.or(column('is_public').eq(true))
);
Auth context helper for accessing authentication information