new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Supabase · Auth · all subjects

auth & rls integration

3 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

RBAC implementation with custom claims and RLS

To implement Role-Based Access Control with custom claims, use a Custom Access Token Auth Hook to add user role claims to the JWT, then create an authorize function that reads the user_role from auth.jwt() and checks permissions against a role_permissions table, finally use this authorize function in RLS policy conditions.

RLS with pgvector for RAG access control

Row Level Security (RLS) can be implemented on top of pgvector to restrict which documents are returned during vector similarity search to users that have access to them. This enables fine-grained access control for retrieval augmented generation (RAG) applications.

Basic RAG schema with RLS

A typical RAG setup uses two tables: a documents table that tracks documents with owner_id field, and a document_sections table that stores content and embedding vectors with a foreign key reference to documents. An RLS policy restricts access to document_sections based on whether the user owns the linked document.

Give your agent this brain