๐Data Restriction
Last updated
Last updated
This document details how to manage your database restriction so that you can control what pages/items a logged-in user can access. For example, User A would see only the items they are assigned to and not anyone else's items.
To limit data based on a logged-in user, you need to first make the app private. Check out how to do so here, Private apps.
Once your app is private, please follow these steps:
Go to the "Users" tab in the left sidebar of your app builder.
Under the "Data Restriction" section, click on "Add Restriction" next to the database whose data you want to limit.
In the "Add Restriction" popup, select the "Restriction Method" from either a "Match Relation to Users Database" (a relation linked to your Users' database) or "Match Property to Users Database".
Select the property based on whose data you'd like to match with the logged-in user.
It's preferred to filter data using the "Match Relation to Users Database" restriction method.
If you select a rollup or formula property under the "Match Property to Users Database"" restriction method, newly added data assigned to the logged-in user will only reflect after 5 seconds in the application. This is because rollups and formulas are calculated on Notion and only after the calculation does our system get to know about the data inside those dynamic Notion properties.
When using the "Match Property to Users Database" method, think of the comparison to be like the example described below: I want my users to see only Projects where Projects.Role (Data Restriction Property) = User.Role (Logged-in User Property).
Click on "Confirm"
Publish the app
Now when a user logs in to the app, they will see only those pages/items of the database where their data restriction property matches OR their data is linked in the user relation property.