# Data Restriction

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.&#x20;



{% embed url="https://www.youtube.com/watch?v=ScfGGLRtxgc" %}

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](private-apps "mention").

Once your app is private, please follow these steps:

1. Go to the "Users" tab in the left sidebar of your app builder.

<figure><img src="https://4233028229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ZqDXcVVffWUqEIZVhmn%2Fuploads%2FzpLAI3I5C3Frh3GEJwbT%2Fusers-tab%20copy.png?alt=media&#x26;token=c5974a58-88e6-460d-9a3b-5ce72c85b09a" alt=""><figcaption></figcaption></figure>

2. Under the "Data Restriction" section, click on "Add Restriction" next to the database whose data you want to limit.&#x20;

<figure><img src="https://4233028229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ZqDXcVVffWUqEIZVhmn%2Fuploads%2F45N8Bt1lL2RLwzfnlJRs%2Fusers-tab-details%20copy.png?alt=media&#x26;token=a952db54-de0f-4a27-811b-fff75ba54146" alt=""><figcaption></figcaption></figure>

3. 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".
4. Select the property based on whose data you'd like to match with the logged-in user.&#x20;

{% hint style="info" %}
It's preferred to filter data using the "Match Relation to Users Database" restriction method.
{% endhint %}

{% hint style="info" %}
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.&#x20;
{% endhint %}

<figure><img src="https://4233028229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ZqDXcVVffWUqEIZVhmn%2Fuploads%2FdVoS5zjonbxopvF8qoto%2Fuser-relation%20copy.png?alt=media&#x26;token=ac0709ac-d34e-4bf6-b576-50eb8206e6ea" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4233028229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ZqDXcVVffWUqEIZVhmn%2Fuploads%2FOoU8pRU0tsAhV0fNesoE%2FSCR-20241202-nvvs-5.png?alt=media&#x26;token=befd2fa4-7cff-44d6-bd23-0a27d822db01" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
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).
{% endhint %}

5. Click on "Confirm"
6. 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.



## Disable Data Restriction on Selected Screens/Components

Data Restriction works on a database level for the whole application. However, there are use cases where you'd want to disable the data restriction on certain screens or components. \
\
For example, in a Project Tracker app, your Users database might be restricted to ensure every user can see only their profile. However, the users should be able to see the name/details of the other users on the Projects screen.&#x20;

To selectively disable data restriction on some screens/components,&#x20;

1. Locate the "Data Restriction" section on your list screen or list components.
2. Disable the "Enabled for this screen/list" toggle.&#x20;

<figure><img src="https://4233028229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ZqDXcVVffWUqEIZVhmn%2Fuploads%2FWN6be6VfkyaYMSST3csF%2FSCR-20250226-oace.png?alt=media&#x26;token=bc8b2ac7-6458-470e-8abb-14d2198f1d38" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4233028229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ZqDXcVVffWUqEIZVhmn%2Fuploads%2FBfczYM5AX4RGhkJz2HDu%2FSCR-20250226-oany.png?alt=media&#x26;token=13c759ad-852e-4232-b325-bb821809acdd" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Similar option to disable data restriction is available in List and Page Selector components.&#x20;
{% endhint %}

{% hint style="danger" %}
When you disable the data restriction for a particular screen/component, the application will receive all the data/rows corresponding to the database.&#x20;
{% endhint %}

