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

# Role-based access control overview

> Understand RBAC concepts and set up your policy in the Stytch Dashboard.

Stytch's RBAC (Role-Based Access Control: An authorization model that manages access to resources within your application based on user roles.) model streamlines the management and enforcement of permissions for Consumer Authentication.

> [card] [RBAC Dashboard](https://stytch.com/dashboard/rbac)
>
> Configure your policy in the Stytch Dashboard.

> [card] [Frontend SDKs](https://stytch.com/docs/api-reference/consumer/frontend-sdks/react/methods/rbac/is-authorized.md)
>
> Gate UI with RBAC checks from the client.

> [card] [Backend checks](https://stytch.com/docs/api-reference/consumer/api/sessions/authenticate-session.md)
>
> Authorize requests on your backend with sessions.authenticate.

## The RBAC Policy

An RBAC policy is a governing document that stores all access controls. It is the canonical source for RBAC authorizations within a Stytch Project, made up of three core concepts:

* **Resources**: entities within your application
  * Examples: `documents`, `images`, `invoices`
* **Actions**: valid operations on a resource
  * Examples: `create`, `read`, `update`, `delete`
* **Roles**: named collections of permissions
  * Examples: `admin`, `editor`, `viewer`

### Resources

A Resource represents an entity in your application and is identified by a unique `resource_id` string you define.

### Actions

Actions are the allowed operations on a Resource. Actions can be standard CRUD operations or application-specific actions like `share`, `invite`, or `export`.

### Roles and permissions

A permission is a combination of a Resource and an Action (for example, `read` on `documents`). Roles are named sets of permissions. A Role can also include the wildcard action `*` to grant all actions for a Resource.

```js theme={null}
{
  "role_id": "reader",
  "permissions": [
    {
      "actions": ["read"],
      "resource_id": "documents"
    }
  ],
  "description": "Readers can view documents."
}
```

## Set up your policy in the Dashboard

**1. Create custom resources and actions**

In the [RBAC Dashboard](https://stytch.com/dashboard/rbac), select **Resources** and **Create New Resource**. Define a `resource_id` and the list of actions allowed for that Resource.

![RBAC Resources in Stytch Dashboard](https://mintcdn.com/stytch-34ca0595/ujkFjtNfcCtlcK2E/images/consumer/from-old-docs/rbac-setup-create-resource.png?fit=max\&auto=format\&n=ujkFjtNfcCtlcK2E\&q=85\&s=5c7f2a2910adafc0b41a9d74d5d53957)

For example, a `documents` Resource might support `create`, `update`, `delete`, and `download`.

![RBAC Resources in Stytch Dashboard](https://mintcdn.com/stytch-34ca0595/ujkFjtNfcCtlcK2E/images/consumer/from-old-docs/rbac-setup-new-resource.png?fit=max\&auto=format\&n=ujkFjtNfcCtlcK2E\&q=85\&s=9f3f00560bbe5e9931fe05bd7e67e282)

**2. Assign permissions to roles**

Navigate to **Roles**. You’ll see a default Role:

* **`stytch_user`**: automatically assigned to all Users and grants basic permissions like updating their own name.

You can edit this Role or create custom Roles. When you add permissions to a Role, select a Resource and choose which actions it grants.

![RBAC Grant Subset of Permissions](https://mintcdn.com/stytch-34ca0595/ujkFjtNfcCtlcK2E/images/consumer/from-old-docs/rbac-setup-assign-permissions.png?fit=max\&auto=format\&n=ujkFjtNfcCtlcK2E\&q=85\&s=f2eb29cab594bbc825aae5a2f073fa4b)

To grant all actions for a Resource, use the wildcard action `*`.

![RBAC Wildcard Actions Grant](https://mintcdn.com/stytch-34ca0595/ujkFjtNfcCtlcK2E/images/consumer/from-old-docs/rbac-setup-wildcard-permissions.png?fit=max\&auto=format\&n=ujkFjtNfcCtlcK2E\&q=85\&s=20ad21f9f7a10eaa81d4fa0177b04231)

**3. Implement backend RBAC checks**

Add server-side authorization checks before honoring requests. See the [backend enforcement guide](https://stytch.com/docs/consumer-auth/authorization/enforcing-permissions.md).

**4. Add frontend RBAC handling**

Use the frontend SDKs to gate UI. See the [frontend authorization section](https://stytch.com/docs/consumer-auth/authorization/enforcing-permissions.md).

## What's next

* [Assign roles to users](https://stytch.com/docs/consumer-auth/authorization/assigning-roles-to-users.md)
* [Enforce permissions](https://stytch.com/docs/consumer-auth/authorization/enforcing-permissions.md)
