createAccessControl API. Every organization member is assigned one of three roles — member, admin, or owner — and each role grants a specific set of permissions over resources like members, invitations, and the organization itself. Permissions are enforced server-side in every server function, so unauthorized actions are rejected before any database query runs.
Roles
Permission matrix
The table below lists every permission in the system and which roles have it.Checking permissions in code
UseauthClient.organization.hasPermission to check whether the current user holds a given permission. The method returns a data object with a success boolean.
Permission checks in UI components are for user experience only. Always enforce permissions server-side in your server functions. Client-side checks can be bypassed.
Adding a new permission resource
When your application needs a resource that does not exist in the default permission set — for example, a billing page — follow these three steps. Step 1 — Register the resource and its actions inlib/auth.ts:
ac.newRole:
