got 403 in while list users

hello, i got error 403 like while doing list users from manager role, but when using admin role, its working headers is present btw using better-auth v.1.2.7 what could be the problem?
No description
No description
No description
Solution:
so i fixed it by created custom permissions like this ``` import { createAccessControl } from "better-auth/plugins/access"; import { adminAc, defaultStatements } from "better-auth/plugins/admin/access"; ...
Jump to solution
1 Reply
Solution
Daniel Tan
Daniel Tan5mo ago
so i fixed it by created custom permissions like this
import { createAccessControl } from "better-auth/plugins/access";
import { adminAc, defaultStatements } from "better-auth/plugins/admin/access";

/**
* make sure to use `as const` so typescript can infer the type correctly
*/
const statement = {
...defaultStatements,
} as const;

export const ac = createAccessControl(statement);

export const karyawan = ac.newRole({
});

export const manager = ac.newRole({
...adminAc.statements,
});

export const admin = ac.newRole({
...adminAc.statements,
});
import { createAccessControl } from "better-auth/plugins/access";
import { adminAc, defaultStatements } from "better-auth/plugins/admin/access";

/**
* make sure to use `as const` so typescript can infer the type correctly
*/
const statement = {
...defaultStatements,
} as const;

export const ac = createAccessControl(statement);

export const karyawan = ac.newRole({
});

export const manager = ac.newRole({
...adminAc.statements,
});

export const admin = ac.newRole({
...adminAc.statements,
});
then just imported on my auth.ts and authClient.ts file idk why on adminRoles is not working

Did you find this page helpful?