Are default roles wiped out when defining a new one?

I'm using the admin plugin, and I wished to add one extra additional role to the defaults. I wish to keep user/admin as-is.
plugins: [
admin({
ac,
roles: {
instructor,
},
adminRoles: ["admin"],
})
plugins: [
admin({
ac,
roles: {
instructor,
},
adminRoles: ["admin"],
})
// permissions.ts
import { createAccessControl } from "better-auth/plugins/access"
import { defaultStatements } from "better-auth/plugins/admin/access"

// Define custom permissions
export const statement = {
...defaultStatements,
// Add any custom resources here if needed in the future
} as const

// Create access controller
export const ac = createAccessControl(statement)

// Define instructor role (same permissions as regular user - no special permissions)
export const instructor = ac.newRole({
user: [],
session: [],
})
// permissions.ts
import { createAccessControl } from "better-auth/plugins/access"
import { defaultStatements } from "better-auth/plugins/admin/access"

// Define custom permissions
export const statement = {
...defaultStatements,
// Add any custom resources here if needed in the future
} as const

// Create access controller
export const ac = createAccessControl(statement)

// Define instructor role (same permissions as regular user - no special permissions)
export const instructor = ac.newRole({
user: [],
session: [],
})
But as an admin, I get 'Action error: You are not allowed to create users'. error
1 Reply
ProEvilz
ProEvilzOP2w ago
i did note the:
When you create custom roles for existing roles, the predefined permissions for those roles will be overridden.
i am not trying to override defaults though

Did you find this page helpful?