> ## 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.

# RBAC (Roles-Based Access Control)

> Enforce RBAC permissions in your application's frontend using the Stytch React SDK

An RBAC (Role-Based Access Control: An authorization model that manages access to resources within your application based on user roles.) policy is a governing document that defines what actions a given Role can take on a given Resource.

> **[Role Object](/docs/api-reference/b2b/api/rbac/role-object.md)**

> **[Resource Object](/docs/api-reference/b2b/api/rbac/resource-object.md)**

To learn more about creating and managing your RBAC policy, see the [RBAC guides](/docs/multi-tenant-auth/enterprise-ready/rbac/create-rbac-policy.md).

## Checking permissions

Each Member Session will be granted specific roles, which grants them permission to take specific actions on specific Resources. To check if a Member has permission to take an action on a Resource, use the [`useStytchIsAuthorized` hook](../../hooks/use-stytch-is-authorized).

> [!WARNING]
>
> Always validate permissions on the client **and** server before proceeding with an action.  See the [Enforcing Permissions guide](/docs/multi-tenant-auth/enterprise-ready/rbac/enforcing-permissions.md#frontend-authorization-checks) and the [Stytch API Reference](/docs/api-reference/b2b/api/rbac/overview.md) for more details.

```jsx theme={null}
import { useStytchIsAuthorized } from '@stytch/react/b2b';

const DocumentActions = () => {
  const { isAuthorized } = useStytchIsAuthorized('documents', 'edit');

  // Check permissions both before taking actions
  const editDocument = () => {
    if (!isAuthorized) {
      throw new Error('You do not have permission to edit documents');
    }

    proceedWithEdit();
  };

  // And to hide or disable UI elements
  return (
    <div>
      <button disabled={!isAuthorized} onClick={editDocument}>Edit Document</button>
    </div>
  );
};
```
