Skip to main content
RefactKit’s RBAC system is built on Better Auth’s 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

Use authClient.organization.hasPermission to check whether the current user holds a given permission. The method returns a data object with a success boolean.
You can use this check in server functions, route loaders, or UI components to conditionally render controls or gate actions.
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 in lib/auth.ts:
Step 2 — Assign the new actions to roles using ac.newRole:
Step 3 — Check the new permission in any server function or component:

Owner protection

Better Auth prevents you from removing the last owner of an organization. If you attempt to delete or demote the only owner, the operation will be rejected. To change ownership, first transfer the owner role to another member, then update or remove the original owner.
Attempting to remove the last owner of an organization without first transferring ownership will result in an error. Always transfer ownership before leaving or deleting an owner account.