Every user sees only theirs.

Access rules are Postgres row-level security in SQL, enforced for every caller. Verify signs in as every role before a release.

What each role could do: rows each role can see and whether it may create, update or delete, for every table, tested on the real databaseWhat each role could do: rows each role can see and whether it may create, update or delete, for every table, tested on the real database
One per role and command
SQL policies
No policy, no rows
Private by default
Pages, actions, scripts and agents
Every caller
explain says which layer refused
Explained

What you get

  • Postgres enforces it

    A bug in a page can't read another user's rows.

  • Private by default

    No policy for a role means no rows.

  • Tested as every user

    verify lists what each role and a visitor can read.

  • Explained when refused

    explain says which layer refused a request, and why.

How access is decided

db/access/booking.sql
-- members read and make their own bookings
create policy booking_read_own on booking for select
  using (member_id = (select ctx.profile_id('member')));

create policy booking_insert_own on booking for insert
  with check (member_id = (select ctx.profile_id('member')));

-- instructors read the bookings for classes they teach
create policy booking_read_instructor on booking for select
  using (exists (select 1 from class_session s
    where s.id = booking.session_id
      and s.instructor_id = (select ctx.profile_id('instructor'))));

-- then, from the agent:
-- explain { "about": "access", "table": "booking",
--           "op": "read", "as": { "role": "member" } }
Ledgerly, personal finance that explains your month, on desktop
Ledgerly keeps every member's money privateOpen Ledgerly

Questions

Who writes the policies?

Your agent, or you, in SQL. They are short: one per role and command. The roles tool and the console's Roles and access page show every role's policies side by side.

What is the difference between a policy and a rule?

A policy decides who may touch which rows. A rule, written as a trigger, decides what may be in them, such as refusing a booking for a full class. Workflows handle what should happen after a write.

Can a page or a script get around them?

No. Requests from pages, scripts and outside tools run as their caller, and Postgres applies the policies. Code that needs more rights says so in a security definer function with a -- @definer comment you review.

Ship it with your agent.

claude mcp add --transport http appbricx https://appbricx.com/api/mcp