> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ditto.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Role-Based Access Control

> Control access to your Ditto database in the portal with role-based access control (RBAC).

## Overview of RBAC

The Ditto portal provides the ability to create, modify, and delete custom roles, allowing you to set fine-grained read-write access controls to database data.

With this you can define organization hierarchies for permissions delegation, set permissions for portal functionality like viewing collections, querying tokens, transferring databases between organizations, and more.

### Organization Permissions Settings

When configuring access control for roles within an organization, there are various types of privileges you can choose from.

These can be accessed from the role editor, available under **Settings** > **Roles**.

The following table provides an overview of the various settings you can configure for roles within an organization.

<Info>
  Some permissions have dependencies on others.

  For example, a role with **Accept incoming database transfer requests** permission will also have **View incoming database transfer requests**.

  Where this applies, these dependent roles will be selected automatically for you when selecting in the role editor.
</Info>

| **Setting**                                    | **Description**                                                                         |
| ---------------------------------------------- | --------------------------------------------------------------------------------------- |
| **Accept incoming database transfer requests** | Initiate, approve, or cancel requests to transfer databases between organizations       |
| **Access audit logs**                          | Review audit logs                                                                       |
| **Create an database**                         | Set up new databases                                                                    |
| **Manage organization members**                | Oversee and administer the membership of an organization                                |
| **View organization details**                  | Access and view details related to the organization                                     |
| **View incoming database transfer requests**   | See requests from other organizations to transfer databases into the organization       |
| **Reject incoming database transfer requests** | Decline requests from other organizations to transfer databases to the organization     |
| **Update the organization details**            | Modify information related to the organization                                          |
| **View access grants**                         | Review the permissions granted to specific users, roles, or organizations               |
| **Manage access grants**                       | Control and administer access privileges granted to other roles within the organization |

## Database Permissions Settings

Following is an overview of the various settings that, once assigned, grant end users the ability to manage the database. (See [Creating Roles](/cloud/portal/role-based-access-control#creating-new-roles))

| **Setting**                                            | **Description**                                                                               |
| ------------------------------------------------------ | --------------------------------------------------------------------------------------------- |
| **Access database data**                               | Access mesh-generated transactional data                                                      |
| **Modify database data**                               | Make changes to mesh-generated transactional data                                             |
| **Access database data bridges**                       | Access CDC Data Bridges and their connection info                                             |
| **Manage database data bridges**                       | Create, update and delete CDC Data Bridges                                                    |
| **Cancel a request for an database transfer**          | Withdraw active requests to transfer databases to other organizations                         |
| **Request offline-only licenses**                      | Manage the licenses designating database for offline usage                                    |
| **Delete an database**                                 | Permanently remove database                                                                   |
| **Create API keys**                                    | Generate unique identifiers used for authentication and authorization access to database data |
| **Delete API keys**                                    | Revoke authentication and authorization to access to database data                            |
| **View database metrics**                              | Review various analytics associated with apps                                                 |
| **View database details**                              | Access and review specific information and settings associated with apps                      |
| **Access API keys**                                    | View the API keys used for authentication and authorization to access database data           |
| **Access offline-only licenses**                       | View the licenses designating database for offline usage                                      |
| **Initiate a request for the transfer of an database** | Transfer ownership of database to other organizations                                         |
| **Update database details**                            | Modify the information and settings associated with databases                                 |
| **Access a MongoDB connector**                         | Access the MongoDB connector configuration                                                    |
| **Manage a MongoDB connector**                         | Make changes to the MongoDB connector configuration                                           |

## Organization Roles

To establish role-based access controls for your organization:

<Steps>
  <Step>
    Create new roles with the desired settings. ([Creating New Roles](/cloud/portal/role-based-access-control#creating-new-roles))
  </Step>

  <Step>
    Designate roles for the appropriate end users within your organization. ([Assigning Roles to End Users](/cloud/portal/role-based-access-control#assigning-roles-to-end-users))
  </Step>
</Steps>

### Creating New Roles

To add a new role to your organization:

<Steps>
  <Step>
    From your organization, click **Settings**.
  </Step>

  <Step>
    Click **Roles**.
  </Step>

  <Step>
    Click **Add new role**.

    <Frame>
      <img src="https://mintcdn.com/ditto-248bc0d1/zD9lJVacy0mXA4hu/images/cloud/portal/rbac-member-role.png?fit=max&auto=format&n=zD9lJVacy0mXA4hu&q=85&s=23d88660556fe184220f46657453d71e" width="1838" height="1268" data-path="images/cloud/portal/rbac-member-role.png" />
    </Frame>
  </Step>

  <Step>
    Click to select and deselect the settings you want to apply to your new role as desired, and then click **Create role**.

    <Warning>
      For organization members to regain read-write access to database data, enable **Access adatabase data** and **Modify database data** in the \*\*Database permissions \*\*as shown in the following graphic.

      Once you've created your role with read-write access permissions, make sure to assign the role to your members as appropriate. ([Assigning Roles](/cloud/portal/role-based-access-control#assigning-roles-to-end-users))
    </Warning>

    <Frame>
      <img src="https://mintcdn.com/ditto-248bc0d1/zD9lJVacy0mXA4hu/images/cloud/portal/rbac-member-role.png?fit=max&auto=format&n=zD9lJVacy0mXA4hu&q=85&s=23d88660556fe184220f46657453d71e" alt="" width="1838" height="1268" data-path="images/cloud/portal/rbac-member-role.png" />
    </Frame>
  </Step>
</Steps>

### Assigning Roles to End Users

Once you've created a role, designate them to the appropriate end users within your organization:

<Steps>
  <Step>
    From **Settings** > **Members**, click **Invite member** located on the right.

    <Frame>
      <img src="https://mintcdn.com/ditto-248bc0d1/zD9lJVacy0mXA4hu/images/cloud/portal/rbac-invite-member.png?fit=max&auto=format&n=zD9lJVacy0mXA4hu&q=85&s=9f2ca345b8c4e74c5d94acfc45f0efb1" width="1067" height="942" data-path="images/cloud/portal/rbac-invite-member.png" />
    </Frame>
  </Step>

  <Step>
    From the **Invite users** modal that appears:

    1. Enter the email belonging to the end user you want to add.
    2. Click **Role** and select the role type you want to assign.
    3. Click **Add to list**.
    4. When finished adding end users to the invite, click **Invite users**.

    <Frame>
      <img src="https://mintcdn.com/ditto-248bc0d1/zD9lJVacy0mXA4hu/images/cloud/portal/rbac-member-list.png?fit=max&auto=format&n=zD9lJVacy0mXA4hu&q=85&s=8b6ec9a605f18374219062c89f1ae9a6" alt="" width="1718" height="1692" data-path="images/cloud/portal/rbac-member-list.png" />
    </Frame>
  </Step>
</Steps>

#### Viewing Pending Member Invitations

Once a member is assigned a role, Ditto automatically sends a formal invitation to the email address specified in the invite, which must be accepted before RBAC privileges take effect.

To view a list of invitations waiting for approval, go to **Settings **>** Members** in the portal. A complete list of invitations display within **Pending member invitations**, as shown in the following graphic:

<Frame>
  <img src="https://mintcdn.com/ditto-248bc0d1/zD9lJVacy0mXA4hu/images/cloud/portal/rbac-pending-member-role.png?fit=max&auto=format&n=zD9lJVacy0mXA4hu&q=85&s=1c8fa3d5e7eea549fe24c57aac9edd1f" alt="" width="1405" height="1175" data-path="images/cloud/portal/rbac-pending-member-role.png" />
</Frame>

### Modifying and Deleting Roles

To edit a role's settings or permanently remove a role from your organization:

<Steps>
  <Step>
    From your organization, click **Settings**.
  </Step>

  <Step>
    Click **Roles**.
  </Step>

  <Step>
    Click the three-dot menu next to the role you want to modify or delete:

    * To modify, select **Edit**.
    * To permanently remove, select **Delete**.

    <Frame>
      <img src="https://mintcdn.com/ditto-248bc0d1/zD9lJVacy0mXA4hu/images/cloud/portal/rbac-member-settings.png?fit=max&auto=format&n=zD9lJVacy0mXA4hu&q=85&s=6185f1d0d60e0b325d678554cfeb8996" width="1620" height="715" data-path="images/cloud/portal/rbac-member-settings.png" />
    </Frame>
  </Step>
</Steps>

## Ditto Employee Access Grants

There are circumstances in which Ditto's support team requires elevated privileges to access your database data, for instance, to troubleshoot an issue.

Ditto employees can only access your database data with an approved *access grant*. An access grant is a formal authorization provided by any of the following to approve the access request initiated by Ditto:

* Current organization owner
* Organization roles configured with\*\* Manage access grants\*\* privileges

Once accepted, you can revoke access grants at any time. (See [Revoking Access](/cloud/portal/role-based-access-control#revoking-access))

For more information, see [Organization Permissions Settings](/cloud/portal/role-based-access-control#organization-permissions-settings) and [Accepting Access Grants](/cloud/portal/role-based-access-control#granting-access).

### Granting Access

To approve a Ditto-initiated access grant:

<Steps>
  <Step>
    Click **Database**.
  </Step>

  <Step>
    From **Access grants**, click **Accept**.

    <Frame>
      <img src="https://mintcdn.com/ditto-248bc0d1/zD9lJVacy0mXA4hu/images/cloud/portal/rbac-member-actions.png?fit=max&auto=format&n=zD9lJVacy0mXA4hu&q=85&s=1259bc261f28498fb8165085746d8e96" width="1284" height="884" data-path="images/cloud/portal/rbac-member-actions.png" />
    </Frame>
  </Step>
</Steps>

### Revoking Access

Once an access grant is approved, you can end access at any time:

<Steps>
  <Step>
    Click **Database**.
  </Step>

  <Step>
    From **Access grants**, click **Revoke access**.

    <Frame>
      <img src="https://mintcdn.com/ditto-248bc0d1/zD9lJVacy0mXA4hu/images/cloud/portal/rbac-member-actions.png?fit=max&auto=format&n=zD9lJVacy0mXA4hu&q=85&s=1259bc261f28498fb8165085746d8e96" width="1284" height="884" data-path="images/cloud/portal/rbac-member-actions.png" />
    </Frame>
  </Step>
</Steps>
