tasks table where each person sees only their own tasks.
1. Create the table in Studio
-
Open your project and choose the
developmentenvironment from the top bar. - In the sidebar, under Data, choose Data. This is the table editor.
- In its secondary sidebar click Create table. A sheet slides in.
-
Details: set Name to
tasks. Leave the other fields as they are. -
Columns: click Add column three times and fill in:
-
Behaviour: set Owner field to
owner_id(filled with the caller’s user id on create). - Access: under Quick access set choose Each user sees and changes their own records.
- Click Save changes.
resource. Click it to open the table editor with its Data, Columns, Access, Indexes, History and Settings tabs.
2. Add a row by hand
Open the Data tab and click Add row. Give it atitle. Leave owner_id empty for now. Studio acts with its own authority, so you can see every row, whoever owns it.
3. Use it from your app
Sign a person in (see Auth), then:owner rule doesn’t match it. That is the rule working.
4. Prove it with a second person
Create a second test user (Users & auth → Users → New user), sign in as them, and listtasks. They get none of the first person’s tasks.
5. See the requests
Open Project → Activity and find the requests from your app. Open one to see who made it, what it returned, and which rule decided.What you have now
- A table, an API for it, and per-person access rules.
- A
developmentcopy you can change freely. When you’re ready, promote the definition toproduction.
Tables and resources
The Create table sheet in full.
Columns and types
Everything a column can be.