Separating and restricting access to data are two common features of building a backend. Separating data is crucial for multi-tenant systems. It means that even though all your users have data in the same table, they are only able to see and access the data that belongs to them. Restricting Access (Role-Based Access Control) takes this to another level if, for example, there are special roles assigned to users like an admin who may have permission to access more data than a standard user. You can read more on restricting access or RBAC by clicking the link at the beginning of this paragraph.Documentation Index
Fetch the complete documentation index at: https://docs.xano.com/llms.txt
Use this file to discover all available pages before exploring further.
Separating Data Example 1
For this example, we have three users in our user table: Steph, Klay, and Jordan.

How to enforce a user only sees the items that belongs to them
Here we have an API endpoint, which gets all the items from the items table. The first step is to require user authentication on the endpoint.




Added layer of security with precondition
We can add an additional layer of security with the use of preconditions. First, use a Get Record on the user table with a field value of the auth id.

How to enforce the user can only edit data that belongs to them
When it comes to editing data, the function stack will also use a precondition. The API endpoint will once again require authentication. First, we need to Get the Record of the item that the user wants to edit.
