> For the complete documentation index, see [llms.txt](https://docs.phocassoftware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.phocassoftware.com/administration/users/manage-a-users-database-access-and-restrictions.md).

# Manage a user's database access and restrictions

Ensure users can only access the data that is relevant to them.

{% hint style="info" %}

* This page outlines how to manage user access and restrictions for one or more databases via the [user's account page](/administration/users/add-update-user/user-account-page.md) and the [Database view](/administration/users.md#users-databaseview) of the **Users** page. To do this for an individual database via the **Databases** page, see [Manage user access and restrictions for a database](/administration/databases-administration.md#manage-user-access-and-restrictions-for-a-database). For other information, see the [Overview of access to data](/administration/overview-of-access-to-data.md) page.
* User permission: [Administration > Users](/administration/users/add-update-user/user-permissions.md#administrator-permissions)
  {% endhint %}

{% hint style="warning" %}
When you update database restrictions for users, you override any [default database restrictions](/administration/databases-administration.md#manage-default-database-restrictions) that might have been applied to the database.
{% endhint %}

{% hint style="success" %}
See this related page: [Update user settings, permissions and restrictions in bulk](/administration/users/add-update-user.md#update-users-in-bulk)
{% endhint %}

{% embed url="<https://phocassoftware.wistia.com/medias/hjafd03lky>" %}
Set user restrictions
{% endembed %}

You can determine a user’s database access when you initially [add the user](/administration/users/add-update-user.md) on the [**Databases** tab](/administration/users/add-update-user/user-account-page.md#usermaintenanceform-databasestab) on the user's account page. Alternatively, you can do it later, again on the user's account page or via the [**Database** view](/administration/users.md#users-databaseview) of the **Users** page.

## Manage database access within a user's account <a href="#manage-database-access-within-a-users-account" id="manage-database-access-within-a-users-account"></a>

The **Databases** tab lists the databases. You can sort the list by any column. Changes you make on this tab save automatically.

<div align="left"><figure><img src="https://3446572173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvQCmtGTR7MsjcI62Vdki%2Fuploads%2FRzTZsPgRP1JBKBvZwHus%2Fimage.png?alt=media&amp;token=400edaf0-72c5-49ec-a73d-445e032f38a8" alt=""><figcaption><p>Databases tab</p></figcaption></figure></div>

1. Open the user's account and select the **Databases** tab.
2. Review the current access and restrictions:
   * If the checkbox is selected, the user has access to the database.
   * The lock icon indicates whether restrictions have been applied. An **unlocked** icon ![](https://3446572173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvQCmtGTR7MsjcI62Vdki%2Fuploads%2Fu0YtIWV8cGCmf5SYeIVB%2Fimage.png?alt=media\&token=46cd13c7-def3-4657-bbc5-554986518ea9) means no restrictions have been applied. A **locked** icon ![](https://3446572173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvQCmtGTR7MsjcI62Vdki%2Fuploads%2FMeHk0YmuuYWDcKNfXy3G%2Fimage.png?alt=media\&token=5a467518-7d52-4974-a270-d0ab9ae7aac1) means one or more restrictions have been applied.<br>

     <div align="left"><figure><img src="https://3446572173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvQCmtGTR7MsjcI62Vdki%2Fuploads%2F9YFjlaAHn02nMn3ES69w%2Fimage.png?alt=media&amp;token=d89c457a-9c75-4048-87aa-0f2de762b960" alt="" width="231"><figcaption></figcaption></figure></div>
3. Manage the user's database access:
   * **Give access**: Select the checkbox. A default period is assigned automatically.
   * **Remove access**: Clear the checkbox.
   * **Change the default period:** Select a different period from the list.
4. Manage the user's database restrictions:
   1. Click the lock icon to open the restrictions window.
   2. Select **Specific to this user**.
   3. Select or clear the measures, streams, and dimensions the user can access.
   4. To restrict access to specific dimension entities:
      1. Select a dimension.
      2. Choose whether entities must match **all** or **any** of the criteria.
      3. Click **Add**.
      4. Define the restriction criteria.
      5. Repeat these steps to add more restrictions, if required.
   5. Click **OK**.

In the restrictions window, you can see dimension, measure, and stream restrictions at a glance, which dimensions have restrictions and how many, and whether restrictions are inherited from the database (default database restrictions) or specific to the user.

<div align="left"><figure><img src="https://3446572173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvQCmtGTR7MsjcI62Vdki%2Fuploads%2FVs8QZ24xJ2IosjDv3xsk%2Fimage.png?alt=media&amp;token=b383c520-1aac-4df8-8f60-f23c0ae891ca" alt="" width="474"><figcaption><p>Restrictions window</p></figcaption></figure></div>

## Manage database access from the Database view <a href="#manage-database-access-from-the-database-view" id="manage-database-access-from-the-database-view"></a>

On the Database view, firstly review the current access and restrictions:

* If a period is selected for a database, it means the user has access to the database. If no period displays (a red outline displays on the period box), it means the user does not have access to that database.
* If the lock icon (**Restrictions** button) next to the period is grey, it means no restrictions have been applied to the database. If a black button displays, it means one or more restrictions have been applied.

Then you can manage the access and restrictions as required:

### Give access to the database

Select a period from the list of *defined* periods that have been set up for the database. This action grants the user access to the database and the period you select becomes the *default* period that is applied when the user opens the database. Learn more about [periods](/basics/getting-started/periods.md), a core concept in Phocas.

### Remove access to the database

Select the *blank* option from the dropdown list.

### Add or update restrictions

1. Click the **Restrictions** button (lock icon) next to the period dropdown list.
2. On the restrictions form, click the **Dimensions**, **Streams** or **Measures** buttons to view a list of their respective data items (entities).
3. Set the access as required: Clear (deselect) the checkbox to restrict access to the item (remove it from the user's view) or select the checkbox to enable access to the item (the user can view it). Expand the sections below for more information and examples.
4. Click **Save** to close the restrictions form.

Any changes you make on the **Database** view of the **Users** page are automatically saved. The next query the user performs on that database will exclude/include the items as applicable.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.phocassoftware.com/administration/users/manage-a-users-database-access-and-restrictions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
