Ashborn013H
Ashborn013H
BABetter Auth
Created by codecret | Software Engineer on 3/18/2025 in #help
you are not allowed to list users 403 error
i hope this helps
15 replies
BABetter Auth
Created by codecret | Software Engineer on 3/18/2025 in #help
you are not allowed to list users 403 error
import { createAccessControl } from "better-auth/plugins/access";
import { defaultStatements, adminAc } from "better-auth/plugins/admin/access";

const statement = {
...defaultStatements,
project : ["create","update","delete"],
userInfo : ["create","update","delete"]

} as const;

export const ac = createAccessControl(statement);



export const superadmin = ac.newRole({
...adminAc.statements,
project : ["create","update","delete"],

})

export const manager = ac.newRole({
project : ["update"],
userInfo : ["update"]
})
export const employee = ac.newRole({
userInfo : ["update"]

})


export const roles = {
superadmin,employee,manager
};
import { createAccessControl } from "better-auth/plugins/access";
import { defaultStatements, adminAc } from "better-auth/plugins/admin/access";

const statement = {
...defaultStatements,
project : ["create","update","delete"],
userInfo : ["create","update","delete"]

} as const;

export const ac = createAccessControl(statement);



export const superadmin = ac.newRole({
...adminAc.statements,
project : ["create","update","delete"],

})

export const manager = ac.newRole({
project : ["update"],
userInfo : ["update"]
})
export const employee = ac.newRole({
userInfo : ["update"]

})


export const roles = {
superadmin,employee,manager
};
15 replies
BABetter Auth
Created by codecret | Software Engineer on 3/18/2025 in #help
you are not allowed to list users 403 error
and this is my auth.ts file
15 replies
BABetter Auth
Created by codecret | Software Engineer on 3/18/2025 in #help
you are not allowed to list users 403 error

plugins: [admin({
ac: ac,
roles: roles,
adminRoles : ["superadmin"],
defaultRole : "employee",

}), bearer(), nextCookies()]

plugins: [admin({
ac: ac,
roles: roles,
adminRoles : ["superadmin"],
defaultRole : "employee",

}), bearer(), nextCookies()]
15 replies
BABetter Auth
Created by codecret | Software Engineer on 3/18/2025 in #help
you are not allowed to list users 403 error
so your auth.ts file shoud have something like this
15 replies
BABetter Auth
Created by codecret | Software Engineer on 3/18/2025 in #help
you are not allowed to list users 403 error
by defult the beeterauth only considers admin as a vaild admin role even if you create a custom admin with admin permition
15 replies
BABetter Auth
Created by Ashborn013H on 3/12/2025 in #help
RBAC
No description
8 replies
BABetter Auth
Created by Ashborn013H on 3/12/2025 in #help
RBAC
After you create the custom admin role you have set it as admin by passing it in the auth.ts file
8 replies
BABetter Auth
Created by Ashborn013H on 3/12/2025 in #help
RBAC
Yep
8 replies